import sqlite3 from datetime import datetime conn = sqlite3.connect('/home/hmo/MoFin/data/mofin.db') for t, c in [('mtf_cache','updated_at'),('macro_context_log','created_at'), ('live_prices','updated_at'),('price_events','created_at'),('market_snapshots','created_at')]: try: row = conn.execute(f"SELECT MAX({c}) FROM {t}").fetchone() print(f"{t}.{c} MAX = {row[0]!r}") if row and row[0]: try: dt = datetime.fromisoformat(str(row[0]).replace('Z','')) print(f" parsed OK: {dt}") except Exception as pe: print(f" PARSE FAIL: {pe}") except Exception as e: print(f"{t}: QUERY ERROR {e}")