DBT DBT Testing & Data Quality 2 — Questions and Answers
Question 1: What does the `store_failures` config on a dbt test do?
- Stops the pipeline on failure
- Persists failing rows to a table in the database (Correct answer)
- Sends a Slack alert
- Logs failures to a local file
Correct answer: Persists failing rows to a table in the database
When `store_failures: true`, dbt creates a table containing the rows that caused the test to fail, useful for debugging.
Question 2: Which severity level causes dbt test to exit with a non-zero code but continue running remaining tests?
- error
- warn (Correct answer)
- info
- debug
Correct answer: warn
Setting `severity: warn` makes dbt report the failure as a warning and continue without stopping the run.
Question 3: Where are singular (bespoke) dbt tests stored in a standard project layout?
- models/
- tests/ (Correct answer)
- macros/
- analyses/
Correct answer: tests/
Singular tests are plain SQL SELECT files placed in the `tests/` directory; a non-empty result means the test fails.
Question 4: What does a singular dbt test return to indicate a failure?
- A boolean FALSE value
- Any non-empty result set (Correct answer)
- A NULL value
- An exception
Correct answer: Any non-empty result set
dbt runs the SQL and considers any rows returned as failures; zero rows means the test passes.
Question 5: Which config allows you to set a threshold so a test only fails if MORE than N rows are returned?
- error_if (Correct answer)
- warn_if
- threshold
- max_failures
Correct answer: error_if
`error_if` accepts a numeric expression (e.g., `>100`) so a test only errors when the failure count exceeds that limit.
Question 6: Which dbt-utils test checks that a numeric column never decreases over time within a partition?
- not_decreasing
- recency
- monotonic_increase (Correct answer)
- expression_is_true
Correct answer: monotonic_increase
`dbt_utils.monotonic_increase` asserts that values in a column are always greater than or equal to the previous row's value.
What does the `store_failures` config on a dbt test do?