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

dbt-utils cardinality_equality schema test not being triggered since dbt=0.20.1 #457

Closed
1 of 5 tasks
feverittm opened this issue Dec 6, 2021 · 1 comment
Closed
1 of 5 tasks
Labels
bug Something isn't working triage

Comments

@feverittm
Copy link

Describe the bug

In our data build we use the dbt_utils test 'cardinality_equality' test in some of our models. Prior to 0.20.1 these tests would run as normal and would be shown in the log file as being executed. However when we upgraded to dbt 0.20.1 and dbt_utils 0.7.0 this test silently does not run. When reviewing the log file it only says 'parsing cardinality_equality', but never executes the test.

 columns:
  - name: printer_id
    description: printer identifier made from the skey
    tests:
      - dbt_utils.cardinality_equality:
          field: printer_id
          to: source('idst_test_sources', 'idst_base_snapshots_newlot')

While I have noted changes in this macro in the release, there does not seem to be any change in the usage documentation. Does the 'column_name' field (which is explicit now) need to be explicitly called out.

Steps to reproduce

This test was ran using both dbt 0.19.1 and dbt_utils 0.6.6 (test runs normally) and using dbt 0.20.1 and dbt_utils 0.7.0 (does not run)

Expected results

I would expect both versions to run in a similar manner.

Actual results

The dbt log file does not show that the test was wan and no indication as to why.

Screenshots and log output

2021-12-03 19:45:18.389470 (MainThread): Parsing macros\schema_tests\at_least_one.sql
2021-12-03 19:45:18.391465 (MainThread): Parsing macros\schema_tests\cardinality_equality.sql
2021-12-03 19:45:18.393460 (MainThread): Parsing macros\schema_tests\equality.sql

This is the only mention of the cardinality_equality test in the log file

System information

The contents of your packages.yml file:
packages:

  • package: fishtown-analytics/dbt_utils
    version: 0.7.0

Which database are you using dbt with?

  • postgres
  • redshift
  • bigquery
  • snowflake
  • other (specify: ____________)

The output of dbt --version:

$ dbt --version
installed version: 0.20.1
   latest version: 0.21.1

Your version of dbt is out of date! You can find instructions for upgrading here:
https://docs.getdbt.com/docs/installation

Plugins:
  - bigquery: 0.20.1
  - postgres: 0.20.1
  - redshift: 0.20.1
  - snowflake: 0.20.1

Additional context

Are you interested in contributing the fix?

@feverittm feverittm added bug Something isn't working triage labels Dec 6, 2021
@joellabes
Copy link
Contributor

Hi @feverittm!

You're being caught up in this issue: dbt-labs/dbt-core#4082

In short, tests that touch multiple models aren't selected in 0.20.x.

If you can, I recommend one of these options:

  • Best: Upgrade to dbt 1.0.0, which returns to the 0.19.x behaviour by default.
  • Alternatively: Upgrade to dbt 0.21.1 which adds a --greedy flag to restore "eager test selection" (refer to the issue above for a more in-depth writeup of what's going on here).
  • If you must stay on 0.20.x for a while, you'll need to include the other model in your test selection syntax as well: dbt test -m source:idst_test_sources.idst_base_snapshots_newlot model_name_here. I discourage this approach; dbt 0.21.1 is the final release before the stable major 1.0 came out last week, and could really be thought of as a polishing release on top of 0.20.x

Let me know if you need more clarification! For now, I'm going to close this as it's not a bug in dbt-utils.

Also a heads up that regardless of your final choice, you should update to dbt-utils 0.7.6, not 0.7.0 🚀

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

No branches or pull requests

2 participants