diff --git a/integration-tests/tests/unit/model_b_references_a.sql b/integration-tests/tests/unit/model_b_references_a.sql index 963b3e5..6eba84e 100644 --- a/integration-tests/tests/unit/model_b_references_a.sql +++ b/integration-tests/tests/unit/model_b_references_a.sql @@ -18,7 +18,7 @@ UNION ALL {% call test_condition_on_model_query('model_b_references_a', "should quote CTE", {}, - assert_should_contain, dbt_unit_testing.quote_identifier("model_a")) %} + assert_should_contain, dbt_unit_testing.quote_identifier("DBT_CTE__model_a")) %} {% call dbt_unit_testing.mock_ref ('model_a') %} select 1 as id {% endcall %} diff --git a/macros/sql_builders.sql b/macros/sql_builders.sql index 90f261d..56321ab 100644 --- a/macros/sql_builders.sql +++ b/macros/sql_builders.sql @@ -38,7 +38,7 @@ {% macro ref_cte_name(node) %} {% set node = dbt_unit_testing.model_node(node) %} - {% set parts = [node.name] %} + {% set parts = ["DBT_CTE", node.name] %} {% if node.package_name != model.package_name %} {% set parts = [node.package_name] + parts %} {% endif %}