在准备环境前提交次全部更改。
This commit is contained in:
40
apps/etl/connectors/feiqiu/scripts/README.md
Normal file
40
apps/etl/connectors/feiqiu/scripts/README.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# scripts/ — 运维与工具脚本
|
||||
|
||||
## 子目录
|
||||
|
||||
| 目录 | 用途 | 典型场景 |
|
||||
|------|------|----------|
|
||||
| `audit/` | 仓库审计(文件清单、调用流、文档对齐分析) | `python -m scripts.audit.run_audit` |
|
||||
| `check/` | 数据检查(ODS 缺口、内容哈希、完整性校验) | `python -m scripts.check.check_data_integrity` |
|
||||
| `db_admin/` | 数据库管理(Excel 导入 DWS 支出/回款/提成) | `python scripts/db_admin/import_dws_excel.py --type expense` |
|
||||
| `export/` | 数据导出(指数、团购、亲密度、会员明细等) | `python scripts/export/export_index_tables.py` |
|
||||
| `rebuild/` | 数据重建(全量 ODS→DWD 重建) | `python scripts/rebuild/rebuild_db_and_run_ods_to_dwd.py` |
|
||||
| `repair/` | 数据修复(回填、去重、hash 修复、维度修复) | `python scripts/repair/dedupe_ods_snapshots.py` |
|
||||
|
||||
## 根目录脚本
|
||||
|
||||
- `run_update.py` — 一键增量更新(ODS → DWD → DWS),适合 cron/计划任务调用
|
||||
- `run_ods.bat` — Windows 批处理:ODS 建表 + 灌入示例 JSON
|
||||
- `compare_ddl_db.py` — DDL 文件与数据库实际表结构对比(支持 `--all` 对比四个 schema)
|
||||
- `validate_bd_manual.py` — BD_Manual 文档体系验证(覆盖率、格式、命名规范)
|
||||
|
||||
## 运行方式
|
||||
|
||||
所有脚本在 ETL 子项目根目录(`apps/etl/connectors/feiqiu/`)执行:
|
||||
|
||||
```bash
|
||||
# 审计报告生成
|
||||
python -m scripts.audit.run_audit
|
||||
|
||||
# 一键增量更新
|
||||
python scripts/run_update.py
|
||||
|
||||
# 数据完整性检查(需要数据库连接)
|
||||
python -m scripts.check.check_data_integrity --window-start "2025-01-01" --window-end "2025-02-01"
|
||||
```
|
||||
|
||||
## 注意事项
|
||||
|
||||
- 所有脚本依赖 `.env` 中的 `PG_DSN` 配置(或环境变量)
|
||||
- `rebuild/` 下的脚本会重建 Schema,生产环境慎用
|
||||
- `repair/` 下的脚本会修改数据,建议先 `--dry-run`(如支持)
|
||||
Reference in New Issue
Block a user