File size: 1,192 Bytes
8a4d54d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | import sqlite3
from pathlib import Path
def main():
db_path = Path(__file__).resolve().parents[1] / "instance" / "finance_analysis.db"
print("DB:", db_path)
conn = sqlite3.connect(db_path)
cur = conn.cursor()
try:
cur.execute(
"SELECT id, project_name, original_filename, row_count, uploaded_at "
"FROM webtoon_project_upload ORDER BY id DESC LIMIT 5"
)
print("\n[최근 업로드 5개]")
for r in cur.fetchall():
print(r)
cur.execute(
"SELECT id, upload_id, task, written_date, author, stage, file_ref, feedback_assignee, episode "
"FROM webtoon_project_task ORDER BY id DESC LIMIT 30"
)
print("\n[최근 업무 30개]")
for r in cur.fetchall():
print(r)
cur.execute(
"SELECT COUNT(*), SUM(CASE WHEN written_date IS NULL OR written_date='' THEN 1 ELSE 0 END) "
"FROM webtoon_project_task"
)
all_cnt, null_cnt = cur.fetchone()
print("\n[작성일 NULL] total=", all_cnt, "null_or_empty=", null_cnt)
finally:
conn.close()
if __name__ == "__main__":
main()
|