severity

Changelog

The "severity" of a test can be configured by supplying the severity configuration option in the test specification. The severity option can be one of warn or error. If warn is supplied, then dbt will log a warning for any failing tests, but the test will still be considered passing. This configuration is useful for tests in which a failure does not imply that action is required.

If a severity level is not provided, then tests are run with the error severity level.

Set the severity for a specific instance of a generic (schema) test:

models/<filename>.yml
version: 2
models:
- name: orders
columns:
- name: order_id
tests:
- unique:
severity: warn

Set the severity for a specific one-off (data) test:

tests/<filename>.sql
{{ config(severity = 'warn') }}
select ...
Changelog

Change the default severity for all tests in a package or project in dbt_project.yml:

tests:
+severity: warn # all tests
<package_name>:
+severity: error # tests in <package_name>

Change the default severity of a generic test:

macros/<filename>.sql
{% test <testname>(model, column_name) %}
{{ config(severity = 'warn') }}
select ...
{% endtest %}