Files
ewoooc/scripts/archive/clear_daily_sales.py
ogt 1b4f3a7bbe
Some checks failed
CD Pipeline / deploy (push) Failing after 59s
feat: EwoooC 初始化 — 完整專案推版至 Gitea
- 建立 Gitea Actions CD pipeline (.gitea/workflows/cd.yaml)
- 部署模式: rsync Python 檔案至 188 → docker restart (volume mount)
- Dockerfile/requirements 變動時自動重建 Docker image
- 部署通知: Telegram (開始/成功/失敗)
- 健康檢查: https://mo.wooo.work/health (最多 5 次重試)
- 同步最新 CLAUDE.md / ADR-008 / memory (2026-04-19)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 01:21:13 +08:00

20 lines
625 B
Python

#!/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}')