-
Notifications
You must be signed in to change notification settings - Fork 112
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
Expected result of nested struct in BigQuery #105
Conversation
Adding this as a note as it is more of feature/discussion than a bugfix. I've seen that you can document nested columns in multiples ways. One way being models:
- name: model_struct
description: ""
columns:
- name: analytics
- name: analytics.source
- name: analytics.medium
- name: analytics.source_medium But there is also the possibility to do (note the nested use of the key models:
- name: model_struct
columns:
- name: analytics
columns:
- name: source
- name: medium
- name: source_medium Since this macro makes favors of one over the other it would be nice to make a small note about this decision. I believe both to be identical but I haven't looked into it sufficiently to be sure. A feature request could be to support both or deprecate one method upstream(dbt-core) to encourage consistency. At the very least document (in the official docs) the canonical way for documenting nested fields (might be done but my google-fu wasn't strong enough). |
Good point! In my experiments, the two variants behaved differently when adding descriptions and then generating the documentation: dbt docs generate
dbt docs serve In my quick tests, your first example rendered the descriptions, but the second didn't. Are you able to get it to include the descriptions when generating and serving the docs? Here's the exact code I used:
select
struct(
"a1" as source,
"b1" as medium,
"c1" as source_medium
) as analytics Worked: version: 2
models:
- name: model_struct
columns:
- name: analytics
description: "This is the name of the STRUCT"
- name: analytics.source
description: "This is the first attribute in the STRUCT"
- name: analytics.medium
description: "This is the second attribute in the STRUCT"
- name: analytics.source_medium
description: "This is the third attribute in the STRUCT" Didn't work: version: 2
models:
- name: model_struct
columns:
- name: analytics
description: "This is the name of the STRUCT"
columns:
- name: source
description: "This is the first attribute in the STRUCT"
- name: medium
description: "This is the second attribute in the STRUCT"
- name: source_medium
description: "This is the third attribute in the STRUCT" |
No, you are correct, the current macro approach works better and they are not the same! Thanks for clarifying and the great velocity on this Issue/PR 💯 |
Thanks for reporting this and all your detailed information @Zatte ! Wouldn't have happened without you 🏅 |
* Expected result of nested struct in BigQuery * Restore the intended rendering of nested `STRUCT` fields in BigQuery * Restore the intended rendering of nested `STRUCT` fields in BigQuery
resolves #98
This is a:
All pull requests from community contributors should target the
main
branch (default).Checklist