diff --git a/crawler/backward_backfill.py b/crawler/backward_backfill.py index a7e077d..06c17a5 100644 --- a/crawler/backward_backfill.py +++ b/crawler/backward_backfill.py @@ -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: