feat(etl): cfg_* 视图入口统一 + NULL 兼容 + 3 处 _load_* 历史 Bug (W1-T2 / P0-1)
Wave 1 Day 3 沙箱配置参数切片。 DB 迁移 (20260504__cfg_views_null_compatible.sql): - 4 个 v_cfg_* 视图 WHERE 加 NULL 兼容 (effective_to IS NULL OR effective_to >= ...) - 顺手清理 v_cfg_assistant_level_price / v_cfg_performance_tier WHERE 重复一次的 bug - 测试库已执行,4 校验 PASS ETL 代码 (4 处 SQL): - base_index_task.py: FROM dws.cfg_index_parameters -> app.v_cfg_index_parameters - base_dws_task.py 3 处 _load_* (performance_tier / level_price / bonus_rules) 改 FROM app.v_cfg_*,顺手修历史 Bug:原 SQL 不带 effective_from/to WHERE 效果: - 修复视图 NULL 行被过滤问题(SPI 27 行原本读到 0) - 沙箱模式回放历史日期时,参数自动按 sandbox_date 切片 - _load_* 直接得到当前生效行(原 12/9 行历史 Python 挑) 参考: - docs/audit/changes/2026-05-04__wave1_t2_scd2_view_unify.md - docs/database/changes/2026-05-04__cfg_views_null_compatible.md
This commit is contained in:
@@ -332,12 +332,13 @@ class BaseIndexTask(BaseDwsTask):
|
||||
|
||||
self.logger.debug("加载指数算法参数: %s", index_type)
|
||||
|
||||
# Wave 1 W1-T2(2026-05-04):走 app.v_cfg_index_parameters 视图,
|
||||
# 视图按 app.business_date_now() 切片(GUC app.current_business_date 决定),
|
||||
# 沙箱模式下自动读取 sandbox_date 当时生效的参数版本。
|
||||
sql = """
|
||||
SELECT param_name, param_value
|
||||
FROM dws.cfg_index_parameters
|
||||
FROM app.v_cfg_index_parameters
|
||||
WHERE index_type = %s
|
||||
AND effective_from <= CURRENT_DATE
|
||||
AND (effective_to IS NULL OR effective_to >= CURRENT_DATE)
|
||||
ORDER BY effective_from DESC
|
||||
"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user