Files
QuantEngineByItz/docs/legacy/verify_admin_db.py
T
kjh2064 15c7971018
WBS-9.3 - NULL Policy CI Gate / NULL Policy Validation (pull_request) Failing after 4s
Quant Engine CI/CD Pipeline / validate-core (pull_request) Failing after 2m15s
Quant Engine CI/CD Pipeline / validate-ui-and-storage (pull_request) Has been skipped
chore: root 경로의 미사용/과거 문서 및 스크립트를 docs/ 하위로 정리 격리
2026-06-26 11:35:42 +09:00

52 lines
1.4 KiB
Python

#!/usr/bin/env python3
import sqlite3
from pathlib import Path
print("="*80)
print("어드민 서버 & DB 연결 검증")
print("="*80)
dbs = {
'kis_data_collection.db': 'src/quant_engine/kis_data_collection.db',
'snapshot_admin.db': 'src/quant_engine/snapshot_admin.db'
}
all_ok = True
for name, path in dbs.items():
if not Path(path).exists():
print(f'[FAIL] {name} not found')
all_ok = False
continue
try:
conn = sqlite3.connect(path)
cursor = conn.cursor()
cursor.execute("SELECT name FROM sqlite_master WHERE type='table'")
tables = [row[0] for row in cursor.fetchall()]
# 각 테이블 행 수
table_info = {}
for table in tables:
if table == 'sqlite_sequence':
continue
cursor.execute(f'SELECT COUNT(*) FROM {table}')
count = cursor.fetchone()[0]
table_info[table] = count
conn.close()
file_size = Path(path).stat().st_size / 1024
print(f'\n[OK] {name} ({file_size:.2f} KB)')
for table, count in sorted(table_info.items()):
print(f' └─ {table}: {count} records')
except Exception as e:
print(f'\n[FAIL] {name}: {e}')
all_ok = False
print("\n" + "="*80)
if all_ok:
print("[결과] [OK] 어드민 서버 & DB 모두 정상 접속")
else:
print("[결과] [FAIL] DB 연결 실패")