Spaces:
Runtime error
Runtime error
Download scripts/check_db.py from welcometoFightclub/acpc-testing-7: direct link, hf CLI and curl.
- Browser
- Download file 859 Bytes
-
https://huggingface.co/spaces/welcometoFightclub/acpc-testing-7/resolve/main/scripts/check_db.py
- Command line
-
hf download hf://spaces/welcometoFightclub/acpc-testing-7/scripts/check_db.py
-
curl -L -o check_db.py https://huggingface.co/spaces/welcometoFightclub/acpc-testing-7/resolve/main/scripts/check_db.py
859 Bytes
| """Quick DB check script.""" | |
| import sqlite3 | |
| conn = sqlite3.connect(r"data/ragdb.sqlite") | |
| # List tables | |
| cur = conn.execute("SELECT name FROM sqlite_master WHERE type='table'") | |
| tables = [r[0] for r in cur.fetchall()] | |
| print("Tables:", tables) | |
| for t in tables: | |
| c = conn.execute(f"SELECT COUNT(*) FROM [{t}]") | |
| print(f" {t}: {c.fetchone()[0]} rows") | |
| # Show columns | |
| ci = conn.execute(f"PRAGMA table_info([{t}])") | |
| cols = [r[1] for r in ci.fetchall()] | |
| print(f" columns: {cols}") | |
| # Quick check distinct institutes | |
| if "cutoffs" in tables: | |
| c2 = conn.execute("SELECT COUNT(DISTINCT institute_name) FROM cutoffs") | |
| print(f"\nDistinct institutes in cutoffs: {c2.fetchone()[0]}") | |
| # Sample | |
| c3 = conn.execute("SELECT DISTINCT city FROM cutoffs LIMIT 10") | |
| print(f"Sample cities: {[r[0] for r in c3.fetchall()]}") | |
| conn.close() | |