# -*- coding: utf-8 -*-
"""验证DWS配置数据"""

import os
from pathlib import Path
from dotenv import load_dotenv
import psycopg2

def main():
    load_dotenv(Path(__file__).parent.parent / ".env")
    dsn = os.getenv("PG_DSN")
    conn = psycopg2.connect(dsn)
    
    tables = [
        "cfg_performance_tier",
        "cfg_assistant_level_price", 
        "cfg_bonus_rules",
        "cfg_area_category",
        "cfg_skill_type"
    ]
    
    print("DWS 配置表数据统计:")
    print("-" * 40)
    
    with conn.cursor() as cur:
        for t in tables:
            cur.execute(f"SELECT COUNT(*) FROM dws.{t}")
            cnt = cur.fetchone()[0]
            print(f"{t}: {cnt} 行")
    
    conn.close()

if __name__ == "__main__":
    main()
