fix: ensure backfill_state table is created inside backward_backfill.py initialization

This commit is contained in:
haneulai 2026-06-16 09:52:44 +09:00
parent 428d4e0d09
commit 7422cd4869

View File

@ -47,6 +47,17 @@ def init_backfill_states(yesterday_str: str):
with get_db_connection() as conn:
cursor = conn.cursor()
# 테이블 자동 생성
cursor.execute("""
CREATE TABLE IF NOT EXISTS backfill_state (
site_id TEXT PRIMARY KEY,
last_backfilled_date TEXT,
consecutive_zero_count INTEGER DEFAULT 0,
status TEXT DEFAULT 'RUNNING'
);
""")
conn.commit()
# NREMS 분할 호기도 식별 가능하게 리스트 빌드
site_ids = []
for p in plants: