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()