WBS-9 진행: API 에러 수정 및 DB 스키마 정규화
- snapshot_admin_store_v1.py: summarize_workspace에서 account_snapshot의 captured_at 사용 (updated_at 대신) - account_snapshot 테이블: 올바른 스키마 재정의 (ordinal PK, row_json, 핵심필드, updated_at) - settings 테이블: 올바른 스키마 재정의 (ordinal PK, key, value_json, note, updated_at) - initialize_snapshot_admin_db.py: XLSX에서 settings, account_snapshot을 올바른 스키마로 로드 - load_from_xlsx_correct.py: account_snapshot을 특별 처리해서 스키마 보존 - /api/settings/save: 정상 작동 (200 응답) - build_ui_state: load_collection_dashboard_state 예외 처리 추가 (진행 중) 데이터 현황: - kis_data_collection.db: 1 테이블 (data_feed), 25행 - snapshot_admin.db: 27 테이블, 7,501행 * settings: 32행 (올바른 스키마) * account_snapshot: 44행 (올바른 스키마) 남은 작업: - /api/state 크래시 원인 진단 및 수정 - /api/export 데이터 검증 - 웹 UI 개선 (백오피스 수준) - T+20 모니터링 활성화 - CI/CD 백업 기능 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
데이터베이스 로드 상태 검증
|
||||
"""
|
||||
|
||||
import sqlite3
|
||||
from pathlib import Path
|
||||
|
||||
def verify_databases():
|
||||
"""두 데이터베이스의 상태 확인"""
|
||||
|
||||
kis_db = Path('src/quant_engine/kis_data_collection.db')
|
||||
snapshot_db = Path('src/quant_engine/snapshot_admin.db')
|
||||
|
||||
print("="*80)
|
||||
print("데이터베이스 로드 상태 검증")
|
||||
print("="*80)
|
||||
|
||||
for db_name, db_path in [("kis_data_collection", kis_db), ("snapshot_admin", snapshot_db)]:
|
||||
print(f"\n[{db_name}]")
|
||||
|
||||
if not db_path.exists():
|
||||
print(f" 파일 없음")
|
||||
continue
|
||||
|
||||
conn = sqlite3.connect(db_path)
|
||||
cursor = conn.cursor()
|
||||
|
||||
# 테이블 목록
|
||||
cursor.execute("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name")
|
||||
tables = [row[0] for row in cursor.fetchall()]
|
||||
print(f" 테이블 수: {len(tables)}")
|
||||
print(f" 테이블: {', '.join(tables[:5])}..." if len(tables) > 5 else f" 테이블: {', '.join(tables)}")
|
||||
|
||||
# 각 테이블의 행 수
|
||||
print(f"\n 테이블별 행 수:")
|
||||
total_rows = 0
|
||||
for table in sorted(tables):
|
||||
try:
|
||||
cursor.execute(f"SELECT COUNT(*) FROM {table}")
|
||||
count = cursor.fetchone()[0]
|
||||
if count > 0:
|
||||
print(f" {table}: {count:,}")
|
||||
total_rows += count
|
||||
except:
|
||||
pass
|
||||
|
||||
print(f" 총 행 수: {total_rows:,}")
|
||||
|
||||
conn.close()
|
||||
|
||||
print("\n[완료]")
|
||||
|
||||
if __name__ == "__main__":
|
||||
verify_databases()
|
||||
Reference in New Issue
Block a user