dbt-labs / dbt-project-evaluator

This package contains macros and models to find DAG issues automatically
https://dbt-labs.github.io/dbt-project-evaluator/latest/
Apache License 2.0
447 stars 67 forks source link

fct_missing_primary_key_tests has dropped fields previously available for filtering exceptions #493

Closed glsdown closed 2 months ago

glsdown commented 2 months ago

Describe the bug

In PR #460 one of the fields that is used for filtering exceptions in fct_missing_primary_key_tests was removed. Specifically model_type and resource_type. It doesn't look intentional as it wasn't called out explicitly so I assume it's a bug rather than a design choice. The change is here

Steps to reproduce

Include a record within dbt_project_evaluator_exceptions that makes use of model_type as a filter:

fct_missing_primary_key_tests,model_type,example_model_type,Models do not have uniqueness available

Then try to run the test and the table won't build.

Expected results

The table builds using the same fields available as previously.

Actual results

The table errors.

Screenshots and log output

Runtime Error in model fct_missing_primary_key_tests (models/marts/tests/fct_missing_primary_key_tests.sql)
  [UNRESOLVED_COLUMN.WITH_SUGGESTION] A column, variable, or function parameter with name `model_type` cannot be resolved. Did you mean one of the following? [`resource_name`, `is_primary_key_tested`, `number_of_tests_on_model`, `number_of_constraints_on_model`]. SQLSTATE: 42703; line 37 pos 20

System information

The contents of your packages.yml file:

packages:
  - package: dbt-labs/dbt_utils
    version: [">=1.0.0", "<1.3.0"]
  - package: dbt-labs/codegen
    version: [">=0.12.0"]
  - package: dbt-labs/audit_helper
    version: [">=0.9.0", "<0.13.0"]
  - package: calogica/dbt_date
    version: [">=0.7.0", "<0.11.0"]
  - package: calogica/dbt_expectations
    version: [">=0.8.0", "<0.11.0"]
  - package: dbt-labs/dbt_project_evaluator
    version: [">=0.14.0", "<0.15.0"]
  - package: elementary-data/elementary
    version: [">=0.15.0", "<0.16.0"]

Which database are you using dbt with?

The output of dbt --version:

dbt Cloud CLI - 0.38.12 (a50c17cf6a620106739f97475ac1b540d3518850 2024-08-27T16:45:34Z)

Additional context

See above for details of the line of code

Are you interested in contributing the fix?

Yes - I'll create a PR shortly