Files
ICU_Display_Management/backend/check_db.py
T

26 lines
627 B
Python

import sqlite3
conn = sqlite3.connect("icu_local.db")
c = conn.cursor()
# List tables
c.execute("SELECT name FROM sqlite_master WHERE type='table'")
print("Tables:", [r[0] for r in c.fetchall()])
# Check display_devices
try:
c.execute("SELECT * FROM display_devices")
rows = c.fetchall()
if rows:
c.execute("PRAGMA table_info(display_devices)")
cols = [col[1] for col in c.fetchall()]
print("Columns:", cols)
for row in rows:
print(dict(zip(cols, row)))
else:
print("No devices registered yet!")
except Exception as e:
print("Error:", e)
conn.close()