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

[Feature Request] Allow selecting dbt_expectations tests by tags #322

Open
siljamardla opened this issue Nov 1, 2024 · 0 comments
Open

Comments

@siljamardla
Copy link

siljamardla commented Nov 1, 2024

With dbt column level tests it is possible to tag the test, for example:

    columns:
      - name: some_column
        data_tests:
          - not_null:
              config:
                tags: some_model_column_tests

And then it's possible to make use of those tags in --select statements, for example:

dbt list --select tag:some_model_column_tests

will return

my_dbt_project_name.my_folder.my_model.not_null_my_model_some_column

I've tried to add a tag to the configuration of a dbt_expectations test, for example:

      - dbt_expectations.expect_table_row_count_to_equal:
          value: 0
          group_by: [created_date]
          row_condition: some_column='failed'
          config:
            tag: some_model_tests
            severity: warn
            store_failures: true

This does not throw an error when parsing the project.

However, the tag is not recognised either. When I try to use it in a --select statement:

dbt list --select tag:some_model_tests

I get nothing.

Where would I like to use these tags?
There's a set of tests that I want to include in the build step of my pipeline, but there's also a set of tests I want to include only in a dedicated data quality monitoring pipeline. Instead of listing them one by one and keeping the lists unified in both places, I'd like to tag the tests. This way I could simplify my select statements to:

dbt build --select my_model --exclude tag:some_model_tests

and

dbt test --select my_model --exclude tag:some_model_column_tests
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

1 participant