25 lines
662 B
Python
Executable File
25 lines
662 B
Python
Executable File
import sqlite3
|
|
import os
|
|
|
|
db_path = "/home/maxi/Projekt/wtc.waiswuaschd.de/data/wtc.db"
|
|
conn = sqlite3.connect(db_path)
|
|
c = conn.cursor()
|
|
|
|
tables = c.execute("SELECT name FROM sqlite_master WHERE type='table'").fetchall()
|
|
print("Tables:", tables)
|
|
|
|
for t in tables:
|
|
tname = t[0]
|
|
cnt = c.execute(f"SELECT COUNT(*) FROM {tname}").fetchone()[0]
|
|
print(f"Table {tname}: {cnt} rows")
|
|
|
|
rows = c.execute("SELECT id, name, category, effort FROM dishes").fetchall()
|
|
print(f"Dishes ({len(rows)}):")
|
|
for r in rows[:5]:
|
|
print(" ", r)
|
|
|
|
r_rows = c.execute("SELECT * FROM recipes").fetchall()
|
|
print(f"Recipes ({len(r_rows)}):")
|
|
for r in r_rows:
|
|
print(" ", r)
|