Test severity levels help decide how serious a test failure is. This guides what action to take when a test fails.
0
0
Test severity levels in dbt
Introduction
When you want to stop your data pipeline if a critical test fails.
When you want to log warnings but continue running if a minor test fails.
When you want to prioritize fixing important data issues first.
When you want to categorize tests by how much they impact your reports.
When you want to communicate test importance clearly to your team.
Syntax
dbt
tests:
- unique:
severity: error
- not_null:
severity: warnThe severity field can be set to error or warn.
error means the test failure is serious and should stop the process.
warn means the failure is less serious and should only warn.
Examples
This test checks uniqueness and treats failure as an error.
dbt
tests:
- unique:
severity: errorThis test checks for nulls but only warns if it fails.
dbt
tests:
- not_null:
severity: warnThis test ensures values are in a list and fails with error severity.
dbt
tests:
- accepted_values:
values: ['active', 'inactive']
severity: errorSample Program
This dbt schema file defines tests on the customers model. The customer_id column must be unique (error if fails) and not null (warn if fails). The status column must have accepted values, failing with error severity.
dbt
version: 2 models: - name: customers columns: - name: customer_id tests: - unique: severity: error - not_null: severity: warn - name: status tests: - accepted_values: values: ['active', 'inactive'] severity: error
OutputSuccess
Important Notes
Severity levels help control your data quality workflow.
Use error for tests that must pass to trust your data.
Use warn for tests that highlight issues but don't block processes.
Summary
Test severity levels tell dbt how serious a test failure is.
error stops the process; warn only warns.
Use severity to manage data quality and workflow priorities.