如果测试具有警告性,我就有一个马科探测器。 警告涉及关系检查。 如果存在警告,逻辑是另一种模式。
{% macro check_test_results() %}
{% for result in results %}
{% if result.status in ["warn", "fail"] %}
{% if result.node.unique_id.startswith("test.prj_dbt.relationships_sch__fact_table_CUSTOMER_CODE__CUSTOMER_CODE__ref_sch___dim_customer_")
or result.node.unique_id.startswith("test.prj_dbt.relationships_sch__fact_table_CUSTOMER_CODE__CUSTOMER_CODE__ref_sch___dim_product_") %}
{{ log("Running exception query due to test failure: " ~ result.node.unique_id, info=True) }}
-- Include your SQL directly here
{% do run_query(
"
select
f.*
from mytable.FACT_SELLOUT f
left join mytable.DIM_CUSTOMER c
on f.CUSTOMER_CODE = c.CUSTOMER_CODE
where c.CUSTOMER_CODE is null
"
) %}
{% endif %}
{% endif %}
{% endfor %}
{% endmacro %}
但是,如果出现这一错误,则KQ无法运行。 此外,我更希望它执行另一个q子档案,而不是可能的话硬纸张。
Encountered an error:
local variable connection referenced before assignment