Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Built-in unique test to not be explicitly added to "primary_key_test_macros" #497

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions models/marts/core/int_all_graph_resources.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

{# flatten the sets of permissable primary key test sets to one level for later iteration #}
{%- set test_macro_list = [] %}
{%- set test_macro_names_list = [] %}
{%- for test_set in var('primary_key_test_macros') -%}
{%- for test in test_set %}
{%- do test_macro_list.append(test) -%}
{%- do test_macro_list.append(test) -%}
{%- endfor %}
{%- endfor -%}
{%- do test_macro_list.append("dbt.test_unique") -%}
{% for test in test_macro_list %}
{%- do test_macro_names_list.append(test.split('.')[1]) -%}
{%- endfor -%}
{%- if "test_unique" not in test_macro_names_list -%}
{%- do test_macro_list.append("dbt.test_unique") -%}
{%- endif -%}
{%- set test_macro_set = set_strict(test_macro_list) -%}

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