Files
stu/_debug.py
T
2026-09-23 09:46:15 +08:00

15 lines
495 B
Python

from database import engine
from sqlalchemy import text
conn = engine.connect()
tables = conn.execute(text("SHOW TABLES")).fetchall()
print('Tables:', tables)
for t in tables:
tname = t[0]
rows = conn.execute(text(f"SHOW COLUMNS FROM `{tname}` WHERE Field = 'is_deleted'")).fetchall()
if rows:
vals = conn.execute(text(f"SELECT is_deleted, COUNT(*) FROM `{tname}` GROUP BY is_deleted")).fetchall()
print(f" {tname}: type={rows[0][1]}, values={vals}")
conn.close()