33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
import sqlite3
|
|
from datetime import datetime
|
|
|
|
THIRD = '/home/hmo/.hermes/profiles/position-analyst/scripts/data/mofin.db'
|
|
MAIN = '/home/hmo/MoFin/data/mofin.db'
|
|
|
|
t = sqlite3.connect(THIRD, timeout=10)
|
|
m = sqlite3.connect(MAIN, timeout=30)
|
|
m.execute('PRAGMA busy_timeout=30000')
|
|
|
|
for table in ['sector_snapshots', 'market_snapshots', 'todos', 'capital_flow_cache']:
|
|
try:
|
|
tcols = [r[1] for r in t.execute(f"PRAGMA table_info({table})")]
|
|
mcols = [r[1] for r in m.execute(f"PRAGMA table_info({table})")]
|
|
print(f'{table}: third_cols={tcols}')
|
|
print(f' main_cols={mcols}')
|
|
tcnt = t.execute(f"SELECT COUNT(*) FROM {table}").fetchone()[0]
|
|
mcnt = m.execute(f"SELECT COUNT(*) FROM {table}").fetchone()[0]
|
|
print(f' third={tcnt} rows, main={mcnt} rows')
|
|
except Exception as e:
|
|
print(f'{table}: ERR {e}')
|
|
print()
|
|
|
|
# sector_snapshots schema in both
|
|
print('sector_snapshots sample (third):')
|
|
for r in t.execute("SELECT * FROM sector_snapshots ORDER BY rowid DESC LIMIT 2"):
|
|
print(' ', str(r)[:200])
|
|
print('sector_snapshots sample (main):')
|
|
for r in m.execute("SELECT * FROM sector_snapshots ORDER BY rowid DESC LIMIT 2"):
|
|
print(' ', str(r)[:200])
|
|
|
|
t.close()
|
|
m.close() |