Files
MoFin/archive/20260722-scripts-cleanup/test_raw_insert.py
T

20 lines
670 B
Python

import sys, sqlite3, traceback
sys.path.insert(0, '/home/hmo/MoFin')
from mofin_db import get_conn, DB_PATH
print('DB_PATH:', DB_PATH)
c = get_conn()
try:
c.execute(
"INSERT INTO price_events (code, name, event_type, price, trigger_value, event_label, date) "
"VALUES (?, ?, ?, ?, ?, ?, ?)",
('TEST99', '测试股', 'entry_zone', 12.34, '12.0~12.5', '加仓区间', '2026-07-20'))
c.commit()
print('INSERT OK')
except Exception as e:
traceback.print_exc()
r = c.execute("SELECT code FROM price_events WHERE code='TEST99'").fetchone()
print('row:', r)
c.execute("DELETE FROM price_events WHERE code='TEST99'")
c.commit()
c.close()