Search code examples
yamldbt

DBT set test severity for all test in a model


In DBT, I can configure the severity of a test on either the project level or test level, like so:

Project level:

tests:
  +severity: warn  # all tests

Column/Test level:

models:
  - name: my_table
    columns:
      - name: my_column
        tests:
          - unique:
              config:
                severity: warn

I am trying to set the severity of all tests for a given model, but am getting a parsing error:

models:
  - name: my_table
    tests:
        +severity: warn  # all tests
    columns:
      - name: my_column
        tests:
          - unique:

Is there a correct way to be doing this? Or should I create a feature request?


Solution

  • You can nest project and directory names under the tests: tag in your dbt_project.yml file:

    tests:
      jaffle_shop:  # project name
        staging:    # top-level dir inside models/ dir
          +severity: warn
    

    See the docs on resource paths for more information.