#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""清除 daily_sales_snapshot 資料表的所有資料"""

from database.manager import DatabaseManager
from sqlalchemy import text

if __name__ == '__main__':
    db = DatabaseManager()
    engine = db.engine

    try:
        with engine.connect() as conn:
            result = conn.execute(text('DELETE FROM daily_sales_snapshot'))
            conn.commit()
            print(f'✅ 已清除 daily_sales_snapshot 資料表中的所有資料')
            print(f'📊 刪除了 {result.rowcount} 筆記錄')
    except Exception as e:
        print(f'❌ 清除失敗: {e}')
