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

Tests applied to models #22

Open
cbeiro opened this issue Jan 26, 2022 · 3 comments
Open

Tests applied to models #22

cbeiro opened this issue Jan 26, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@cbeiro
Copy link

cbeiro commented Jan 26, 2022

Hi!

Thanks for developing this package.

Is it possible to take into account tests that are applied to models and not only to columns? For example https://github.com/dbt-labs/dbt-utils#equal_rowcount-source or the tests created by https://github.com/mjirv/dbt-datamocktool.

Thanks!

@sweco
Copy link
Collaborator

sweco commented Jan 27, 2022

Hey @cbeiro! 😊 We're glad that you like dbt-coverage!

We were indeed thinking about adding table-level coverage (both docs and test) but haven't had time to do so yet. One possibility of doing so would be to just mix the table-level coverage in between the columns but I guess ideally we would allow selecting between table-level, column-level, or mixed coverage, which would require a bit more work.

What do you think about the approaches?

@aranke
Copy link

aranke commented Jan 29, 2022

Another approach I considered for a similar project was creating a boolean column to indicate whether the table had coverage.

Could probably use true/false for JSON and / for the console output.

The reasoning behind this approach is that the denominator of the table-level coverage will always be 1.

@sweco
Copy link
Collaborator

sweco commented Feb 16, 2022

You're right @k-aranke, the denominator would always be 1. With the table-level coverage, the most interesting would be the totals as they would show the percentage of tables covered.

As for what I see as the easiest implementation of the table-level coverage is to automatically generate an imaginary column called for example <table> for every table and use it to reflect whether the table is covered with table-level docs or tests. The report would then look like this:

=========================================================================
- jaffle_shop.customers          -/-       (-)    ->     6/8    (75.00%) 
-- <table>                       -/-       (-)    ->     0/1     (0.00%) 
-- new_col                       -/-       (-)    ->     0/1     (0.00%) 
=========================================================================

On the other hand, I'm not sure this helps much for the tests because based on my knowledge, people usually only aim to cover very few columns with tests (IDs, maybe FKs) and they are not interested in the coverage of the other ones. Therefore, they are mostly after knowing whether there is at least one column covered with tests per table.

@mrshu mrshu added the enhancement New feature or request label Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants