ehsan-dashboards/dashboards/check_sqlite_cols.py

13 lines
384 B
Python

import sqlite3
conn = sqlite3.connect("/workspace/personal/blu/saman_bank_all_transactions.sqlite")
cur = conn.cursor()
cur.execute("SELECT name FROM sqlite_master WHERE type='table'")
tables = cur.fetchall()
print("Tables:", tables)
for t in tables:
cur.execute(f"PRAGMA table_info({t[0]})")
print(f"\nColumns of {t[0]}:")
for col in cur.fetchall():
print(col)