fix: 增量脚本日志去重 + index_daily 空表自动初始化
This commit is contained in:
@@ -38,6 +38,7 @@ from importer import (
|
||||
)
|
||||
|
||||
logger = logging.getLogger("incremental")
|
||||
logger.propagate = False
|
||||
if not logger.handlers:
|
||||
h = logging.StreamHandler()
|
||||
h.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(message)s"))
|
||||
@@ -109,7 +110,12 @@ def run_daily(end_date, dry_run, limit):
|
||||
]:
|
||||
max_d = get_max_date(conn, table, date_col)
|
||||
if max_d is None:
|
||||
logger.warning(f" {table}: 表为空,请先执行全量导入 (full_import)")
|
||||
if table == "index_daily":
|
||||
logger.warning(" index_daily: 表为空,自动全量初始化(6个指数,很快)")
|
||||
if not dry_run:
|
||||
import_index_daily(start_date=None, end_date=end_date)
|
||||
else:
|
||||
logger.warning(f" {table}: 表为空,请先执行全量导入 (full_import)")
|
||||
continue
|
||||
start = (max_d + timedelta(days=1)).strftime("%Y-%m-%d")
|
||||
if start > end_date:
|
||||
|
||||
Reference in New Issue
Block a user