Skip to main content

store_failures_as

For the test resource type, store_failures_as is an optional config that specifies how test failures should be stored in the database. If store_failures is also configured, store_failures_as takes precedence.

The three supported values are:

  • ephemeral — nothing stored in the database (default)
  • table — test failures stored as a database table
  • view — test failures stored as a database view

You can configure it in all the same places as store_failures, including singular tests (.sql files), generic tests (.yml files), and dbt_project.yml.

Examples

Singular test

Singular test in tests/singular/check_something.sql file

{{ config(store_failures_as="table") }}

-- custom singular test
select 1 as id
where 1=0

Generic test

Generic tests in models/_models.yml file

models:
- name: my_model
columns:
- name: id
tests:
- not_null:
config:
store_failures_as: view
- unique:
config:
store_failures_as: ephemeral

Project level

Config in dbt_project.yml

name: "my_project"
version: "1.0.0"
config-version: 2
profile: "sandcastle"

tests:
my_project:
+store_failures_as: table
my_subfolder_1:
+store_failures_as: view
my_subfolder_2:
+store_failures_as: ephemeral

"Clobbering" configs

As with most other configurations, store_failures_as is "clobbered" when applied hierarchically. Whenever a more specific value is available, it will completely replace the less specific value.

Additional resources:

0