melodix-api / check_tasks.py
GitHub Action
deploy from github actions
440bac0
Raw
History Blame Contribute Delete
1.14 kB
from sqlalchemy import create_engine, text
DATABASE_URL = 'sqlite:///./musical_master.db'
print("Connecting to Local SQLite...")
try:
engine = create_engine(DATABASE_URL)
with engine.connect() as conn:
print("--- Table Record Counts ---")
tables = ["users", "tasks", "devices", "iglesias", "groups", "lyrics"]
for table in tables:
try:
res = conn.execute(text(f"SELECT count(*) FROM {table};"))
count = res.scalar()
print(f"Table '{table}': {count} records")
except Exception as e:
print(f"Table '{table}' error: {e}")
print("\n--- Recent Tasks in Local SQLite ---")
try:
res = conn.execute(text("SELECT id, task_id, song_name, status, created_at FROM tasks ORDER BY created_at DESC LIMIT 5;"))
rows = res.fetchall()
for r in rows:
print(f"ID: {r[0]} | TaskID: {r[1]} | Song: {r[2]} | Status: {r[3]} | Created: {r[4]}")
except Exception as e:
print("Tasks error:", e)
except Exception as e:
print("Error:", e)