Fix dashboard stats: support flat sync_state.json format (no 'tables' wrapper)

BigQuery adapter writes table entries at top level, not nested under 'tables'.
Detect flat format by checking if values contain 'rows' key.
This commit is contained in:
Petr 2026-03-15 00:26:10 +01:00
parent b3ba65be59
commit 85c07732b2

View file

@ -234,6 +234,9 @@ def _load_data_stats() -> dict:
state = json.load(f)
tables_data = state.get("tables", {})
# Support flat format (table_id at top level, no "tables" wrapper)
if not tables_data and any(isinstance(v, dict) and "rows" in v for v in state.values()):
tables_data = {k: v for k, v in state.items() if isinstance(v, dict) and "rows" in v}
if not tables_data:
return dict(FALLBACK_DATA_STATS)