Files
QUZ/check_all_dbs.py
root 4c2ce929d9 py
2026-06-27 02:21:09 +00:00

20 lines
786 B
Python

import sqlite3
import os
for root, dirs, files in os.walk(r"./"):
for f in files:
if f.endswith(".db") or ".db" in f:
path = os.path.join(root, f)
try:
conn = sqlite3.connect(path)
c = conn.cursor()
c.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='QuizQuestions'")
if c.fetchone():
c.execute("SELECT COUNT(*) FROM QuizQuestions WHERE category = ?", ("파생상품투자권유자문인력",))
count = c.fetchone()[0]
if count > 0:
print(f"File: {os.path.relpath(path, r'./')} | Count: {count}")
conn.close()
except Exception as e:
pass