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

Bug in Overriding primary_key_test_macros Variable #470

Closed
1 of 6 tasks
savannahchunn opened this issue Jul 1, 2024 · 1 comment · Fixed by #472
Closed
1 of 6 tasks

Bug in Overriding primary_key_test_macros Variable #470

savannahchunn opened this issue Jul 1, 2024 · 1 comment · Fixed by #472
Labels
bug Something isn't working triage

Comments

@savannahchunn
Copy link

Describe the bug

Overriding the primary_key_test_macros variable to a set of tests that does not include a reference to the dbt.test_unique causes an unresolved column error in the int_model_test_summary model.

Steps to reproduce

At first, I set the primary_key_test_macros variable to be just the below boxed section of our team's custom unique test and the built-in dbt not null test.
image

Expected results

I expected these two tests to be an acceptable set for the primary key check.

Actual results

The use of just the boxed test macros resulted in the below column error where int_mdoel_test_summary was looking for a is_test_unique column in the all_graph_resources model, but due to my team's custom unique test, only a is_test_unique_full column was created in all_graph_resources.
image

Screenshots and log output

Screenshots seen above.

System information

The contents of your packages.yml file:
packages:

  • package: calogica/dbt_date
    version: 0.10.1
  • package: dbt-labs/dbt_utils
    version: 1.2.0
  • package: dbt-labs/dbt_project_evaluator
    version: 0.12.0

Which database are you using dbt with?

  • postgres
  • redshift
  • bigquery
  • snowflake
  • trino/starburst
  • other (specify: Databricks)

The output of dbt --version:
image

Additional context

I think the below line 18 of int_model_test_summary is causing the issue, but I'm not sure if this is_test_unqiue setup is needed by other project evaluator processes.
image

Instead of trying to change the project evaluator code, I took a band-aid approach by updating our primary_key_test_macros variable to include a second set of tests, the dbt_utils.test_unqiue_combination_of_columns and the dbt.test_unqiue macros. Having the dbt unqiue test resolves the unknown column error I was getting, but it does open up the slim chance that models in our project pass the evaluator check with a testing approach different than our team's standard.
image

Are you interested in contributing the fix?

Not at this time, but I'm happy to provide more context if needed.

@savannahchunn savannahchunn added bug Something isn't working triage labels Jul 1, 2024
@b-per
Copy link
Collaborator

b-per commented Jul 2, 2024

Thanks for the report. I will have a look at it today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants