-
Notifications
You must be signed in to change notification settings - Fork 975
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## What are you changing in this pull request and why? Closes: #4246 Adding a page for resource config `store_failures_as` ## Checklist - [x] Add versioning components, as described in [Versioning Docs](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-entire-pages) - [x] Add a note to the prerelease version [Migration Guide](https://github.com/dbt-labs/docs.getdbt.com/tree/current/website/docs/guides/migration/versions) - [x] Review the [Content style guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md) and [About versioning](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#adding-a-new-version) so my content adheres to these guidelines. - [x] Add a checklist item for anything that needs to happen before this PR is merged, such as "needs technical review" or "change base branch." Adding new pages (delete if not applicable): - [x] Add page to `website/sidebars.js` - [x] Provide a unique filename for the new page
- Loading branch information
Showing
5 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
website/docs/reference/resource-configs/store_failures_as.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
resource_types: [tests] | ||
id: "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`](/reference/resource-configs/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](https://docs.getdbt.com/docs/build/tests#singular-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](https://docs.getdbt.com/docs/build/tests#generic-tests) in `models/_models.yml` file | ||
|
||
```yaml | ||
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` | ||
|
||
```yaml | ||
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: | ||
|
||
- [Test configurations](/reference/test-configs#related-documentation) | ||
- [Test-specific configurations](/reference/test-configs#test-specific-configurations) | ||
- [Configuring directories of models in dbt_project.yml](/reference/model-configs#configuring-directories-of-models-in-dbt_projectyml) | ||
- [Config inheritance](/reference/configs-and-properties#config-inheritance) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters