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

all fields in BigQuery struct need to be specified in a unit test #5331

Closed
graciegoheen opened this issue Apr 23, 2024 · 1 comment · Fixed by #5367
Closed

all fields in BigQuery struct need to be specified in a unit test #5331

graciegoheen opened this issue Apr 23, 2024 · 1 comment · Fixed by #5367
Labels
dbt-core v1.8 unit testing docs for 1.8 unit testing

Comments

@graciegoheen
Copy link
Collaborator

          Thanks for reporting this @edudosaara !

After getting insights from @MichelleArk, we believe we should probably document this as a known limitation, and I've opened #5307 as a result.

All fields in a BigQuery struct need to be specified in a unit test -- it's not currently possible to use only a subset of columns in a struct.

But we agree that we'd like to support this.

To support this, it would probably take writing some struct-specific handling of missing fields in the safe_cast method.

Workaround

Include all the fields in a BigQuery struct within the unit test.

Originally posted by @dbeatty10 in dbt-labs/dbt-bigquery#1184 (comment)

@graciegoheen
Copy link
Collaborator Author

I think we could add this caveat to this docs page -> https://docs.getdbt.com/reference/resource-properties/data-types

@graciegoheen graciegoheen added dbt-core v1.8 unit testing docs for 1.8 unit testing labels Apr 23, 2024
runleonarun added a commit that referenced this issue Apr 27, 2024
## 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dbt-core v1.8 unit testing docs for 1.8 unit testing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant