demo / scripts /debug_audiodescriptions_db.py
VeuReu's picture
Upload 35 files
6397e15 verified
raw
history blame
1.06 kB
from pathlib import Path
import sqlite3
BASE = Path(__file__).resolve().parent.parent
ADB = BASE / "temp" / "audiodescriptions.db"
print(f"AUDIODESCRIPTIONS_DB: {ADB} (exists={ADB.exists()})")
if not ADB.exists():
raise SystemExit("❌ audiodescriptions.db no existeix")
conn = sqlite3.connect(str(ADB))
conn.row_factory = sqlite3.Row
cur = conn.cursor()
print("\n[SCHEMA] PRAGMA table_info(audiodescriptions):")
try:
cur.execute("PRAGMA table_info(audiodescriptions)")
for row in cur.fetchall():
# row: (cid, name, type, notnull, dflt_value, pk)
print(f" - cid={row['cid']}, name={row['name']}, type={row['type']}, notnull={row['notnull']}, pk={row['pk']}")
except Exception as e:
print("Error llegint esquema:", e)
print("\n[DATA] Primeres 10 files de audiodescriptions:")
try:
cur.execute("SELECT * FROM audiodescriptions LIMIT 10")
rows = cur.fetchall()
for r in rows:
print(" -", dict(r))
except Exception as e:
print("Error llegint dades:", e)
conn.close()