import sqlite3
import sys
def inspect_db(path, label):
print(f"=== {label}: {path} ===")
try:
conn = sqlite3.connect(path)
cursor = conn.cursor()
cursor.execute("SELECT name FROM sqlite_master WHERE type='table'")
tables = cursor.fetchall()
for t in tables:
print(f"Table: {t[0]}")
cursor.execute(f'PRAGMA table_info("{t[0]}")')
cols = cursor.fetchall()
for c in cols:
print(f" {c[1]} {c[2]}")
cursor.execute(f'SELECT COUNT(*) FROM "{t[0]}"')
count = cursor.fetchone()[0]
print(f" Rows: {count}")
if count > 0 and count < 50:
cursor.execute(f'SELECT * FROM "{t[0]}" LIMIT 5')
for row in cursor.fetchall():
print(f" Sample: {row}")
print()
conn.close()
except Exception as e:
print(f"ERROR: {e}")
print()
inspect_db('/home/hermes/.hermes/project_management.db', 'project_management.db')
inspect_db('/home/hermes/.hermes/kanban.db', 'kanban.db')