Initial commit: What To Cook (WTC) v4.4 - Digitales Kochbuch, Wochenmenueplan & Buchdruck
This commit is contained in:
Executable
+24
@@ -0,0 +1,24 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user