From 7422cd4869f4a8ba0652d87b0d3c3e4ef8143814 Mon Sep 17 00:00:00 2001 From: haneulai Date: Tue, 16 Jun 2026 09:52:44 +0900 Subject: [PATCH] fix: ensure backfill_state table is created inside backward_backfill.py initialization --- crawler/backward_backfill.py | 11 +++++++++++ 1 file changed, 11 insertions(+) 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: