Files
yrtv/scripts/check_tables.py

44 lines
1.4 KiB
Python

import sqlite3
import os
DB_PATH = r'd:\Documents\trae_projects\yrtv\database\L2\L2_Main.sqlite'
def check_tables():
if not os.path.exists(DB_PATH):
print(f"DB not found: {DB_PATH}")
return
conn = sqlite3.connect(DB_PATH)
cursor = conn.cursor()
tables = [
'dim_players', 'dim_maps',
'fact_matches', 'fact_match_teams',
'fact_match_players', 'fact_match_players_ct', 'fact_match_players_t',
'fact_rounds', 'fact_round_events', 'fact_round_player_economy'
]
print(f"--- L2 Database Check: {DB_PATH} ---")
for table in tables:
try:
cursor.execute(f"SELECT COUNT(*) FROM {table}")
count = cursor.fetchone()[0]
print(f"{table:<25}: {count:>6} rows")
# Simple column check for recently added columns
if table == 'fact_match_players':
cursor.execute(f"PRAGMA table_info({table})")
cols = [info[1] for info in cursor.fetchall()]
if 'util_flash_usage' in cols:
print(f" [OK] util_flash_usage exists")
else:
print(f" [ERR] util_flash_usage MISSING")
except Exception as e:
print(f"{table:<25}: [ERROR] {e}")
conn.close()
if __name__ == "__main__":
check_tables()