What if you could instantly know which data problems need your attention right now?
Why Test severity levels in dbt? - Purpose & Use Cases
Start learning this pattern below
Jump into concepts and practice - no test required
Imagine you run a data project where you check your data quality by manually scanning error logs and spreadsheets to find problems.
You get many alerts but can't tell which ones are urgent or which can wait.
This manual way is slow and confusing.
You waste time fixing small issues that don't matter much, while missing big problems that break your reports.
Errors pile up and you lose trust in your data.
Test severity levels let you label data tests as error, warn, or info.
This helps you focus on fixing the most important problems first.
It organizes your alerts so you know what to act on immediately and what to monitor.
run all tests and check logs manuallyseverity: error\nseverity: warn\nseverity: info
With test severity levels, you can quickly spot and fix the biggest data issues before they cause harm.
A data analyst uses severity levels to catch critical data mismatches that would break dashboards, while ignoring minor warnings that don't affect decisions.
Manual checking mixes all problems together, causing confusion.
Severity levels prioritize data tests by importance.
This saves time and improves data trust.
Practice
ERROR do?Solution
Step 1: Understand dbt test severity levels
dbt uses severity levels to decide what happens when a test fails.Step 2: Identify the effect of ERROR severity
When severity is set to ERROR, dbt stops the run immediately on failure.Final Answer:
It stops the dbt run if the test fails. -> Option AQuick Check:
ERROR severity = stops run [OK]
- Confusing ERROR with WARN severity
- Thinking ERROR retries the test
- Assuming ERROR ignores failures
Solution
Step 1: Recall YAML syntax for dbt test severity
dbt expects severity as a key-value pair with uppercase values like WARN or ERROR.Step 2: Identify correct syntax
The correct syntax uses a colon and uppercase WARN:severity: WARN.Final Answer:
severity: WARN -> Option CQuick Check:
YAML key-value with uppercase WARN = correct [OK]
- Using lowercase 'warn' instead of uppercase
- Using equals sign instead of colon
- Spelling severity value incorrectly
tests:
- unique:
column_name: id
severity: WARNWhat happens if the test fails during a dbt run?
Solution
Step 1: Analyze the severity level in the test config
The severity is set to WARN, which means dbt should warn but not stop.Step 2: Understand dbt behavior on WARN severity
When a test fails with WARN severity, dbt logs a warning and continues the run.Final Answer:
The failure is logged as a warning, but the run continues. -> Option AQuick Check:
WARN severity = warn and continue [OK]
- Thinking WARN stops the run
- Assuming WARN ignores failures
- Believing tests retry automatically
tests:
- not_null:
column_name: user_id
severity: ERRORBut your dbt run does not stop when the test fails. What is the likely problem?
Solution
Step 1: Check correct placement of severity in dbt tests
Severity must be set inside theconfigblock, not directly under the test.Step 2: Identify why run does not stop
Since severity is misplaced, dbt ignores it and uses default behavior, so run does not stop.Final Answer:
The severity key is misplaced; it should be under 'config'. -> Option BQuick Check:
Severity must be inside config = The severity key is misplaced; it should be under 'config'. [OK]
- Using lowercase severity value
- Misplacing severity outside config
- Assuming test name is wrong
email column?Solution
Step 1: Recall correct severity placement in dbt YAML
Severity must be inside aconfigblock under each test.Step 2: Match severities to tests as required
Setnot_nullseverity to WARN anduniqueseverity to ERROR inside their config blocks.Final Answer:
Tests with severity inside config: not_null WARN, unique ERROR. -> Option DQuick Check:
Severity inside config with correct WARN/ERROR = tests: - not_null: column_name: email config: severity: WARN - unique: column_name: email config: severity: ERROR [OK]
- Placing severity outside config block
- Swapping WARN and ERROR severities
- Using lowercase severity values
