dbt-coverage
dbt-coverage copied to clipboard
support generic tests from dbt_utils when calculating coverage
Our project is relying on tests defined in dbt_utils - is there a way of adding support for these as well?
https://github.com/dbt-labs/dbt-utils#unique_combination_of_columns-source
@aa-matthias I presume these are currently not supported by dbt-coverage -- would that be the case?
Would you mind preparing a minimal example we could take a look at to better understand what would be needed to support these tests fully?
Thanks!
Hi @mrshu - i've checked how tested columns are currently fetched in:
https://github.com/slidoapp/dbt-coverage/blob/main/dbt_coverage/init.py#L147
the problem is that for unique_combination_of_columns tests specified by dbt_utils kwargs are looking different - see the following example:
"test_metadata": {
"name": "unique_combination_of_columns",
"kwargs": {
"combination_of_columns": [
"id",
"version_id"
],
"model": "{{ get_where_subquery(ref('sw6_base_order')) }}"
},
"namespace": "dbt_utils"
},
I see, thanks @aa-matthias. I guess this would only concern the unique_combination_of_columns test though, right? All the others seem to be defined on the column level, which the dbt-coverage should be able to cover in its current version.
yes, i think this is the only one - we're currently making use of these as there are several models have no single column primary key / unique key. however it looks like it's best practice to add these so maybe we'll do that instead than also giving us enough coverage.
@aa-matthias, we are using the official dbt-docs logic to parse the tests. If you generate the documentation, does the test get marked correctly in the UI for the columns?