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

support generic tests from dbt_utils when calculating coverage #32

Open
aa-matthias opened this issue Jun 18, 2022 · 5 comments
Open

support generic tests from dbt_utils when calculating coverage #32

aa-matthias opened this issue Jun 18, 2022 · 5 comments

Comments

@aa-matthias
Copy link

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

@mrshu
Copy link
Contributor

mrshu commented Jul 30, 2022

@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!

@aa-matthias
Copy link
Author

aa-matthias commented Aug 20, 2022

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"
            },

@mrshu
Copy link
Contributor

mrshu commented Nov 3, 2022

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.

@aa-matthias
Copy link
Author

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.

@sweco
Copy link
Collaborator

sweco commented Nov 21, 2022

@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?

Screenshot 2022-11-21 at 17 37 22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants