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

[Core] Singular data tests can now be documented #6132

Closed
FishtownBuildBot opened this issue Sep 24, 2024 · 0 comments · Fixed by #6191
Closed

[Core] Singular data tests can now be documented #6132

FishtownBuildBot opened this issue Sep 24, 2024 · 0 comments · Fixed by #6191
Assignees
Labels
content Improvements or additions to content dbt Core The changes proposed in this issue relate to dbt Core dbt-core v1.9 improvement Use this when an area of the docs needs improvement as it's currently unclear

Comments

@FishtownBuildBot
Copy link

FishtownBuildBot commented Sep 24, 2024

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.
Originating from this issue: dbt-labs/dbt-core#9005
Original pull request: dbt-labs/dbt-core#10744
New pull request: dbt-labs/dbt-core#10792

Page(s) to update

Code examples

tests/my_singular_test.sql

with my_cte as (
    select 1 as id, 'foo' as name
    union all
    select 2 as id, 'bar' as name
)
select * from my_cte

Without docs blocks

tests/_properties.yml

data_tests:
  - name: my_singular_test
    description: Some docs
    config:
      error_if: ">10"
    meta:
      some_key: some_val

With docs blocks

Or with docs blocks:

tests/example.md

{% docs my_singular_test_documentation %}
Some docs from a doc block
{% enddocs %}

tests/_properties.yml

data_tests:
  - name: my_singular_test
    description: "{{ doc('my_singular_test_documentation') }}"
    config:
      error_if: ">10"
    meta:
      some_key: some_val

List 'em and run 'em

List 'em:

$ dbt list --resource-type test -q 

my_project.my_singular_test

Run 'em:

$ dbt test -s my_project.my_singular_test

19:55:23  Running with dbt=1.9.0-a1
19:55:23  Registered adapter: postgres=1.9.0-a1
19:55:23  Found 1 test, 423 macros
19:55:23  
19:55:23  Concurrency: 5 threads (target='postgres')
19:55:23  
19:55:24  1 of 1 START test my_singular_test ............................................. [RUN]
19:55:24  1 of 1 FAIL 2 my_singular_test ................................................. [FAIL 2 in 0.10s]
19:55:24  
19:55:24  Finished running 1 test in 0 hours 0 minutes and 1.13 seconds (1.13s).
19:55:24  
19:55:24  Completed with 1 error, 0 partial successs, and 0 warnings:
19:55:24  
19:55:24  Failure in test my_singular_test (tests/my_singular_test.sql)
19:55:24    Got 2 results, configured to fail if != 0
19:55:24  
19:55:24    compiled code at target/compiled/my_project/tests/my_singular_test.sql
19:55:24  
19:55:24  Done. PASS=0 WARN=0 ERROR=1 SKIP=0 TOTAL=1
@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 Sep 24, 2024
@graciegoheen graciegoheen changed the title [Core] Docs Changes Needed from dbt-core Issue #9005 [Core] dbt-core Issue #9005 - singular tests can now be documented Sep 24, 2024
@dbeatty10 dbeatty10 self-assigned this Sep 30, 2024
@dbeatty10 dbeatty10 changed the title [Core] dbt-core Issue #9005 - singular tests can now be documented [Core] Singular data tests can now be documented Sep 30, 2024
dbeatty10 added a commit that referenced this issue Oct 1, 2024
Resolves #6132
Originally #6147

## What are you changing in this pull request and why?

The `description` property is available for singular data tests
beginning in dbt v1.9, and this PR highlights how singular tests can now
be documented.

### 🎩 Previews
-
[`description`](https://docs-getdbt-com-git-dbeatty-6132-docs-dbt-labs.vercel.app/reference/resource-properties/description)
-
[`docs-paths`](https://docs-getdbt-com-git-dbeatty-6132-docs-dbt-labs.vercel.app/reference/project-configs/docs-paths)
- [documentation
placement](https://docs-getdbt-com-git-dbeatty-6132-docs-dbt-labs.vercel.app/docs/build/documentation#placement)

### Additional information

Opened #6193 since we
don't have documentation how to add a `description` for the Jinja macro
associated with custom generic tests. This follow-up will allow us to
consider the `description` of both generic and singular data tests in
context of each other.


## Checklist
- [x] I have reviewed the [Content style
guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md)
so my content adheres to these guidelines.
- [x] The topic I'm writing about is for specific dbt version(s) and I
have versioned it according to the [version a whole
page](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#adding-a-new-version)
and/or [version a block of
content](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-blocks-of-content)
guidelines.
- [x] Wait until dbt-labs/dbt-core#10792 is
merged
- [x] Add a note to the prerelease version [Migration
Guide](https://github.com/dbt-labs/docs.getdbt.com/tree/current/website/docs/docs/dbt-versions/core-upgrade)

---------

Co-authored-by: Natalie Fiann <Natalie.Fiann@dbtlabs.com>
Co-authored-by: nataliefiann <120089939+nataliefiann@users.noreply.github.com>
Co-authored-by: Mirna Wong <89008547+mirnawong1@users.noreply.github.com>
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.9 improvement Use this when an area of the docs needs improvement as it's currently unclear
Projects
None yet
4 participants