# 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`](./store_failures.md) 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](../../docs/build/data-tests.md#singular-data-tests) in `tests/singular/check_something.sql` file

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

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

#### Generic test

[Generic tests](../../docs/build/data-tests.md#generic-data-tests) in `models/_models.yml` file

```yaml
models:
  - name: my_model
    columns:
      - name: id
        data_tests:
          - not_null:
              config:
                store_failures_as: view
          - unique:
              config:
                store_failures_as: ephemeral
```

#### Project level

Config in `dbt_project.yml`

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

data_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:

* [Data test configurations](../data-test-configs.md#related-documentation)
* [Data test-specific configurations](../data-test-configs.md#test-data-specific-configurations)
* [Configuring directories of models in dbt\_project.yml](../model-configs.md#configuring-directories-of-models-in-dbt_projectyml)
* [Config inheritance](../define-configs.md#config-inheritance)

## Was this page helpful?

YesNo

[Privacy policy](https://www.getdbt.com/cloud/privacy-policy)[Create a GitHub issue](https://github.com/dbt-labs/docs.getdbt.com/issues)

This site is protected by reCAPTCHA and the Google [Privacy Policy](https://policies.google.com/privacy) and [Terms of Service](https://policies.google.com/terms) apply.
