Soma / scratch /check_db.py
Komalpreet Kaur
Final UI and project refinements
eb6d588 unverified
Raw
History Blame Contribute Delete
530 Bytes
import sqlite3
db_path = "soma_sessions.db"
try:
conn = sqlite3.connect(db_path)
cursor = conn.cursor()
cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
tables = cursor.fetchall()
print(f"Tables: {tables}")
for table in tables:
table_name = table[0]
cursor.execute(f"SELECT COUNT(*) FROM {table_name}")
count = cursor.fetchone()[0]
print(f"Table {table_name} has {count} rows")
conn.close()
except Exception as e:
print(f"Error: {e}")