Skip to content

Commit

Permalink
Merge pull request #472 from dbt-labs/fix/primary-key-macros-without-…
Browse files Browse the repository at this point in the history
…unique
  • Loading branch information
b-per authored Jul 18, 2024
2 parents 3df4c79 + d7e3061 commit 1e66191
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion integration_tests_2/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ models:

vars:
max_depth_dag: 2
chained_views_threshold: 2
chained_views_threshold: 2
primary_key_test_macros: [["my_package.test_my_test", "dbt.test_not_null"]]
4 changes: 3 additions & 1 deletion models/marts/core/int_all_graph_resources.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
{%- do test_macro_list.append(test) -%}
{%- endfor %}
{%- endfor -%}
{%- do test_macro_list.append("dbt.test_unique") -%}
{%- set test_macro_set = set_strict(test_macro_list) -%}

{%- set quoted_directory_pattern = wrap_string_with_quotes(get_directory_pattern()) %}

Expand Down Expand Up @@ -69,7 +71,7 @@ joined as (
end as model_type_folder,
{{ dbt.position(dbt.concat([quoted_directory_pattern, 'naming_convention_folders.folder_name_value', quoted_directory_pattern]),'unioned_with_calc.directory_path') }} as position_folder,
nullif(unioned_with_calc.column_name, '') as column_name,
{% for test in test_macro_list %}
{% for test in test_macro_set %}
unioned_with_calc.macro_dependencies like '%macro.{{ test }}%' and unioned_with_calc.resource_type = 'test' as is_{{ test.split('.')[1] }},
{% endfor %}
unioned_with_calc.is_enabled,
Expand Down

0 comments on commit 1e66191

Please sign in to comment.