question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dbt run, test, seed, etc. counts exclude disabled models but include tests that depend on disabled models

See original GitHub issue

Describe the bug

When running dbt compile, dbt run, dbt test, etc., a count of objects in the dbt project are provided, like this:

Found 45 models, 252 tests, 0 snapshots, 0 analyses, 123 macros, 0 operations, 0 seed files, 57 sources

This count excludes dbt models which are disabled, but includes tests which depend on disabled models. This is confusing and inconsistent.

Steps To Reproduce

Create a model and some associated schema tests that are related to the model. Execute dbt compile and look at the counts for the models and tests in the project, e.g.

Found 45 models, 252 tests, 0 snapshots, 0 analyses, 123 macros, 0 operations, 0 seed files, 57 sources

Disable the model. Run dbt compile and observe the number of objects associated with the project. The number of models will have decreased by one but the number of tests will have remained constant even though some of the tests depend on the disabled model, e.g.:

Found 44 models, 252 tests, 0 snapshots, 0 analyses, 123 macros, 0 operations, 0 seed files, 57 sources

Expected behavior

The more immediate behavior to fix the bug would be to exclude tests that are disabled from the count of objects generated from dbt commands. So in the scenario above, assuming that two tests depend on the disabled model, the count of objects after disabling the model should exclude these two tests and be:

Found 44 models, 250 tests, 0 snapshots, 0 analyses, 123 macros, 0 operations, 0 seed files, 57 sources

A more helpful longer-term approach might be to include and count both enabled and disabled objects, such as:

Found 44 enabled models, 1 disabled model, 250 enabled tests, 2 disabled tests, 0 snapshots, 0 analyses, 123 macros, 0 operations, 0 seed files, 57 sources

I understand that there are a lot of mechanical reasons why it is difficult to count disabled models. But given that disabled tests are already being lumped in with enabled tests in the counts, it should hopefully not be that hard to at least call out the number of enabled vs. disabled tests as per the following:

Found 44 models, 250 enabled tests, 2 disabled tests, 0 snapshots, 0 analyses, 123 macros, 0 operations, 0 seed files, 57 sources

Screenshots and log output

Already above.

System information

Which database are you using dbt with? Snowflake

The output of dbt --version:

installed version: 0.14.2
   latest version: 0.14.2

Up to date!

The operating system you’re using: Mac OS Mojave 10.14.5

The output of python --version: Python 2.7.10

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
NiallReescommented, Dec 28, 2019
0reactions
drewbanincommented, Jan 21, 2020

closed by #2026

Read more comments on GitHub >

github_iconTop Results From Across the Web

dbt run, test, seed, etc. counts exclude disabled models but ...
This count excludes dbt models which are disabled, but includes tests which depend on disabled models. This is confusing and inconsistent.
Read more >
enabled - dbt Developer Hub
An optional configuration for disabling models, seeds, snapshots, and tests. Default: true. When a resource is disabled, dbt will not consider ...
Read more >
dbt: Model 'bar' depends on model 'foo' which was not found ...
Given all this, when I run the dbt command, I get the error Model 'model.my_proj.baz_mytable' depends on model 'myinfo' which was not found...
Read more >
dbt Guide - GitLab
Apparently the model tree you are building includes some large or complex models ... test takes the same --model and --exclude syntax referenced...
Read more >
pytest Documentation - Read the Docs
How to re-run failed tests and maintain state between test runs . ... one can run pytest with the legacypath plugin disabled:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found