Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support test results as a view dbt-core PR #8653 #4246

Closed
FishtownBuildBot opened this issue Oct 10, 2023 · 2 comments · Fixed by #4270
Closed

Support test results as a view dbt-core PR #8653 #4246

FishtownBuildBot opened this issue Oct 10, 2023 · 2 comments · Fixed by #4270
Assignees
Labels
content Improvements or additions to content dbt Core The changes proposed in this issue relate to dbt Core dbt-core v1.7 Docs impact for the v1.7 release (Oct 2023) improvement Use this when an area of the docs needs improvement as it's currently unclear

Comments

@FishtownBuildBot
Copy link

FishtownBuildBot commented Oct 10, 2023

dbt-labs/dbt-core#8653

At a minimum, update body to include a link to the page on docs.getdbt.com requiring updates and what part(s) of the page you would like to see updated.

Pages:

@runleonarun runleonarun added content Improvements or additions to content improvement Use this when an area of the docs needs improvement as it's currently unclear dbt Core The changes proposed in this issue relate to dbt Core labels Oct 10, 2023
@dbeatty10 dbeatty10 added the dbt-core v1.7 Docs impact for the v1.7 release (Oct 2023) label Oct 10, 2023
@dbeatty10 dbeatty10 added this to the dbt Core v1.7 Documentation milestone Oct 10, 2023
@graciegoheen graciegoheen changed the title Docs Changes Needed from dbt-core PR #8653 Support test results as a view dbt-core PR #8653 Oct 11, 2023
@runleonarun runleonarun self-assigned this Oct 11, 2023
@runleonarun
Copy link
Collaborator

@dbeatty10 👋🏻
There's a ton of info in the linked issue and PR. Can you help us understand this change and which docs it affects? Here's my assessment so far:

It sounds like we're introducing this feature to provide a more lightweight storage than storing test failures in tables because that's resource heavy and possibly unnecessary.

Definition: Storing failures lets you examine records that cause tests to fail, so you can either repair the data or change the test as needed.

I'm guessing we need:

  1. Does store_failures_as apply to Specific test, Singular test, Generic test block, and Project level like store_failures does?
  2. Can you help with some code examples too?

🙏🏻 thanks!

@runleonarun runleonarun removed their assignment Oct 11, 2023
@matthewshaver matthewshaver self-assigned this Oct 12, 2023
@dbeatty10
Copy link
Contributor

tl;dr

For the test resource type, store_failures_as is an optional config that specifies how test failures should be stored in the database (and takes precedence over store_failures). The three valid values are:

  1. ephemeral - nothing stored in the database (default)
  2. table - test failures stored as a database table
  3. view - test failures stored as a database view

Where it applies

It is configurable in all the same places as store_failures, including singular tests (.sql files), generic tests (.yml files), and dbt_project.yml. See examples below for details.

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

Most configurations are "clobbered" when applied hierarchically, and store_failures_as is no different! Whenever a more-specific value is available, it will completely replace the less-specific value. Read more in the links below:

matthewshaver added a commit that referenced this issue Oct 12, 2023
## 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Improvements or additions to content dbt Core The changes proposed in this issue relate to dbt Core dbt-core v1.7 Docs impact for the v1.7 release (Oct 2023) improvement Use this when an area of the docs needs improvement as it's currently unclear
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants