fix: backfill key_signal_type without sqlite3.Row in init_db
Use tuple indices because init_db connects before row_factory is set. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -101,8 +101,9 @@ def backfill_missing_key_signal_types(conn, *, monitor_type: str = KEY_MONITOR_T
|
||||
(mt,),
|
||||
).fetchall()
|
||||
for row in rows:
|
||||
sym = row["symbol"]
|
||||
opened = (row["opened_at"] or "").strip()
|
||||
# init_db 连接未设 row_factory,结果为 tuple
|
||||
rid, sym, opened_at = row[0], row[1], row[2]
|
||||
opened = (opened_at or "").strip()
|
||||
for signal in KEY_MONITOR_AUTO_TYPES:
|
||||
hist = conn.execute(
|
||||
"""SELECT monitor_type FROM key_monitor_history
|
||||
@@ -115,7 +116,7 @@ def backfill_missing_key_signal_types(conn, *, monitor_type: str = KEY_MONITOR_T
|
||||
continue
|
||||
conn.execute(
|
||||
"UPDATE trade_records SET key_signal_type=? WHERE id=?",
|
||||
(signal, row["id"]),
|
||||
(signal, rid),
|
||||
)
|
||||
updated += 1
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user