在前后端开发联调前 的提交20260223

This commit is contained in:
Neo
2026-02-23 23:02:20 +08:00
parent 254ccb1e77
commit fafc95e64c
1142 changed files with 10366960 additions and 36957 deletions

View File

@@ -105,7 +105,13 @@ def _iter_rows(
def _build_report_path(out_arg: str | None) -> Path:
if out_arg:
return Path(out_arg)
reports_dir = PROJECT_ROOT / "reports"
env_root = os.environ.get("ETL_REPORT_ROOT")
if not env_root:
raise KeyError(
"环境变量 ETL_REPORT_ROOT 未定义。"
"请在根 .env 中配置,参考 docs/deployment/EXPORT-PATHS.md"
)
reports_dir = Path(env_root)
reports_dir.mkdir(parents=True, exist_ok=True)
ts = datetime.now().strftime("%Y%m%d_%H%M%S")
return reports_dir / f"ods_content_hash_check_{ts}.json"

View File

@@ -986,7 +986,7 @@ def main() -> int:
else:
tag = f"_{args.tag}" if args.tag else ""
stamp = datetime.now(tz).strftime("%Y%m%d_%H%M%S")
out_path = PROJECT_ROOT / "reports" / f"ods_gap_check{tag}_{stamp}.json"
out_path = Path(os.environ.get("ETL_REPORT_ROOT", PROJECT_ROOT / "reports")) / f"ods_gap_check{tag}_{stamp}.json"
out_path.parent.mkdir(parents=True, exist_ok=True)
out_path.write_text(json.dumps(payload, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
logger.info("REPORT_WRITTEN path=%s", out_path)

View File

@@ -69,7 +69,9 @@ def _load_ods_columns(dsn: str) -> Dict[str, Set[str]]:
def main() -> None:
"""主流程:遍历 FILE_MAPPING 中的 ODS 表,检查 JSON 键覆盖情况并打印报告。"""
dsn = os.environ.get("PG_DSN")
json_dir = pathlib.Path(os.environ.get("JSON_DOC_DIR", "export/test-json-doc"))
json_dir = pathlib.Path(os.environ.get("JSON_DOC_DIR") or os.environ.get("ODS_JSON_DOC_DIR", ""))
if not str(json_dir):
raise KeyError("环境变量 JSON_DOC_DIR 或 ODS_JSON_DOC_DIR 未定义。请在根 .env 中配置。")
ods_cols_map = _load_ods_columns(dsn)