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

Data_tests callout #5017

Merged
merged 14 commits into from
Mar 14, 2024
Merged
33 changes: 33 additions & 0 deletions website/docs/docs/build/data-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ keywords:
* [Data test configurations](/reference/data-test-configs)
* [Test selection examples](/reference/node-selection/test-selection-examples)

<VersionBlock firstVersion="1.8">

:::important

With the addition of unit tests in dbt v1.8, what was previously called "tests" are now "data tests". In dbt v1.8, `tests:` is still supported in your YML configuration file as an alias for data tests but will be deprecated in the future in favor of `data_tests:`. See [New syntax](#new-`tests:`-syntax) for more information.
matthewshaver marked this conversation as resolved.
Show resolved Hide resolved

:::

</VersionBlock>

## Overview

Data tests are assertions you make about your models and other resources in your dbt project (e.g. sources, seeds and snapshots). When you run `dbt test`, dbt will tell you if each test in your project passes or fails.
Expand Down Expand Up @@ -251,6 +261,29 @@ Note that, if you select to store test failures:
* Test result tables are created in a schema suffixed or named `dbt_test__audit`, by default. It is possible to change this value by setting a `schema` config. (For more details on schema naming, see [using custom schemas](/docs/build/custom-schemas).)
- A test's results will always **replace** previous failures for the same test.

<VersionBlock firstVersion="1.8">
matthewshaver marked this conversation as resolved.
Show resolved Hide resolved

## New `tests:` syntax
matthewshaver marked this conversation as resolved.
Show resolved Hide resolved

With the addition of unit tests in dbt v1.8, `tests` are now `data tests`. In dbt v1.8, `tests:` is still supported in your YML configuration file as an alias but will be deprecated in the future in favor of `data_tests:`.
matthewshaver marked this conversation as resolved.
Show resolved Hide resolved

As we progress towards this deprecation, the examples in our docs pages will be updated to reflect this new syntax, but we highly recommend you begin the migration process as soon as you upgrade to v1.8 to avoid interruptions or issues in the future.

matthewshaver marked this conversation as resolved.
Show resolved Hide resolved
```yml

models:

name: orders
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the yml spacing looks a bit weird here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2024-02-29 at 7 08 53 PM

columns:
name: order_id
data_tests:
unique
not_null


```
</VersionBlock>

## FAQs

<FAQ path="Tests/test-one-model" />
Expand Down
Loading