读上一版快照改为取全部列并归一空值

这个函数 2026-09-07 起也给计划装配用,要按环节名索引、再读采信倾向与自我校验。
原先只取算迁移用的五列,环节名是空的,按环节索引必然为空,产业研判这一路整个缺席。
上一处修改(读 ds 当天或之前的最近一版)方向对了,但被这一层挡住,周一计划里可用数
仍为零。

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
zlt 2026-09-07 09:33:40 +08:00
parent fcd1f547f6
commit 05c5e2f889
1 changed files with 5 additions and 2 deletions

View File

@ -202,7 +202,10 @@ def load_previous(day: str, read_mysql=None) -> dict:
try: try:
rows = sources._records(reader( # noqa: SLF001 —— 同仓自用 rows = sources._records(reader( # noqa: SLF001 —— 同仓自用
"factor", "factor",
f"SELECT {', '.join(_PREV_COLS)} FROM {table} " # 取全部列而不是只取算迁移用的那五列:这个函数 2026-09-07 起也给计划装配用,
# 它要按环节名索引、再读采信倾向与自我校验——只取五列时环节名是空的,
# 产业研判这一路就整个缺席(周一计划里可用数为零,就是这个原因)。
f"SELECT * FROM {table} "
f"WHERE plan_date >= %s AND plan_date < %s ORDER BY plan_date", (start, day))) f"WHERE plan_date >= %s AND plan_date < %s ORDER BY plan_date", (start, day)))
except Exception as e: # noqa: BLE001 —— 头一次跑时表还不存在,属正常 except Exception as e: # noqa: BLE001 —— 头一次跑时表还不存在,属正常
print(f" {table} 读不到历史行,本次全部按第一次见到处理: {e!r}") print(f" {table} 读不到历史行,本次全部按第一次见到处理: {e!r}")
@ -211,7 +214,7 @@ def load_previous(day: str, read_mysql=None) -> dict:
for r in rows: # 按计划日升序读,同一簇键后来的覆盖先来的 for r in rows: # 按计划日升序读,同一簇键后来的覆盖先来的
key = str(r.get("cluster_key") or "").strip() key = str(r.get("cluster_key") or "").strip()
if key: if key:
out[key] = dict(r) out[key] = {k: _blank_to_none(v) for k, v in dict(r).items()}
return out return out