Skip to content

Commit

Permalink
Clarifying BigQuery unit test (#5367)
Browse files Browse the repository at this point in the history
## What are you changing in this pull request and why?

Closes #5331
Closes #5307

## Checklist
<!--
Uncomment when publishing docs for a prerelease version of dbt:
- [ ] 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)
- [ ] 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)
-->
- [x] Review 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] For [docs
versioning](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#about-versioning),
review how to [version a whole
page](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#adding-a-new-version)
and [version a block of
content](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-blocks-of-content).
- [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."

---------

Co-authored-by: Leona B. Campbell <[email protected]>
  • Loading branch information
matthewshaver and runleonarun authored Apr 27, 2024
1 parent 5aacd09 commit b09ed0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion website/docs/docs/build/unit-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ Now, we are introducing a new type of test to dbt - unit tests. In software prog
## Before you begin

- We currently only support unit testing SQL models.
- We currently don't support unit testing models that use recursive SQL.
- We currently only support adding unit tests to models in your _current_ project.
- We currently *don't* support unit testing models that use recursive SQL.
- You must specify all fields in a BigQuery STRUCT in a unit test. You cannot use only a subset of fields in a STRUCT.
- If your model has multiple versions, by default the unit test will run on *all* versions of your model. Read [unit testing versioned models](#unit-testing-versioned-models) for more information.
- Unit tests must be defined in a YML file in your `models/` directory.

Expand Down
3 changes: 3 additions & 0 deletions website/docs/reference/resource-properties/data-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ unit_tests:
struct_field: 'struct("Isha" as name, 22 as age)'
struct_of_struct_field: 'struct(struct(1 as id, "blue" as color) as my_struct)'
struct_array_field: ['struct(st_geogpoint(75, 45) as my_point)', 'struct(st_geogpoint(75, 35) as my_point)']
# Make sure to include all the fields in a BigQuery `struct` within the unit test.
# It's not currently possible to use only a subset of columns in a 'struct'


```

Expand Down

0 comments on commit b09ed0e

Please sign in to comment.