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

Added description section to data tests doc #6867

Merged
merged 14 commits into from
Feb 6, 2025
Merged
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions website/docs/reference/data-test-configs.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ version: 2
tests:
- <test_name>: # # Actual name of the test. For example, dbt_utils.equality
name: # Human friendly name for the test. For example, equality_fct_test_coverage
[description](/reference/resource-properties/description): "markdown formatting"
<argument_name>: <argument_value>
[config](/reference/resource-properties/config):
[fail_calc](/reference/resource-configs/fail_calc): <string>
Expand All @@ -102,6 +103,7 @@ version: 2
tests:
- <test_name>:
name:
description: "markdown formatting"
nataliefiann marked this conversation as resolved.
Show resolved Hide resolved
<argument_name>: <argument_value>
[config](/reference/resource-properties/config):
[fail_calc](/reference/resource-configs/fail_calc): <string>
Expand Down Expand Up @@ -182,6 +184,7 @@ version: 2
tests:
- <test_name>: # Actual name of the test. For example, dbt_utils.equality
name: # Human friendly name for the test. For example, equality_fct_test_coverage
description: "markdown formatting"
nataliefiann marked this conversation as resolved.
Show resolved Hide resolved
<argument_name>: <argument_value>
[config](/reference/resource-properties/config):
[enabled](/reference/resource-configs/enabled): true | false
Expand All @@ -197,6 +200,7 @@ version: 2
tests:
- <test_name>:
name:
description: "markdown formatting"
nataliefiann marked this conversation as resolved.
Show resolved Hide resolved
<argument_name>: <argument_value>
[config](/reference/resource-properties/config):
[enabled](/reference/resource-configs/enabled): true | false
Expand Down Expand Up @@ -296,3 +300,40 @@ models:
```

Given the config, the data test runs on a different Snowflake virtual warehouse than the one in your default connection to enable better price-performance with a different warehouse size or more granular cost allocation and visibility.

#### Add a description to generic and singular tests

Starting from dbt v1.9 (also available to dbt Cloud [release tracks](/docs/dbt-versions/cloud-release-tracks)), you can add [descriptions](/reference/resource-properties/data-tests#description) to both generic and singular tests.
nataliefiann marked this conversation as resolved.
Show resolved Hide resolved

For a generic test, add the description in line with the existing YAML:

<File name='models/staging/<filename>.yml'>

```yml

models:
- name: my_model
columns:
- name: delivery_status
tests:
- accepted_values:
values: ['delivered', 'pending', 'failed']
description: "This test checks whether there are unexpected delivery statuses. If it fails, check with logistics team"

```
</File>

For a singular test, define it in the test's directory:

<File name='tests/my_custom_test.yml'>

```yml

data_tests:
- name: my_custom_test
description: "This test checks whether the rolling average of returns is inside of expected bounds. If it isn't, flag to customer success team"

```
</File>

For more information refer to [Add a description to a data test](/reference/resource-properties/description#add-a-description-to-a-data-test).
Loading