Closed dbeatty10 closed 1 year ago
The following was originally reported and described here by @Zatte
Output will be ambiguous in the case of multiple sub-structs (nested columns) with the same name.
Use the dbt-bigquery adapter and the following files:
packages.yml
packages: - package: dbt-labs/codegen version: 0.9.0
models/model_struct.sql
select struct( "a1" as a, "b1" as b ) as substruct1, struct( "a2" as a, "b2" as b ) as substruct2
Then run the following:
dbt deps dbt run-operation generate_model_yaml --args '{"model_names": ["model_struct"]}'
version: 2 models: - name: model_struct description: "" columns: - name: substruct1 description: "" - name: substruct1.a description: "" - name: substruct1.b description: "" - name: substruct2 description: "" - name: substruct2.a description: "" - name: substruct2.b description: ""
version: 2 models: - name: model_struct description: "" columns: - name: substruct1 description: "" - name: a description: "" - name: b description: "" - name: substruct2 description: "" - name: a description: "" - name: b description: ""
Which database are you using dbt with?
The output of dbt --version:
dbt --version
$ dbt --version Core: - installed: 1.3.1 - latest: 1.3.1 - Up to date! Plugins: - bigquery: 1.3.0 - Up to date!
I'll open a PR for this. The most time-consuming part will be modifying the integration tests.
Simple fix is described here:
- {% do model_yaml.append(' - name: ' ~ column.name | lower ) %} + {% do model_yaml.append(' - name: ' ~ column_name | lower ) %}
This fix is verified to work as described in my local environment.
The following was originally reported and described here by @Zatte
Describe the bug
Output will be ambiguous in the case of multiple sub-structs (nested columns) with the same name.
Steps to reproduce
Use the dbt-bigquery adapter and the following files:
packages.yml
models/model_struct.sql
Then run the following:
Expected results
Actual results
System information
Which database are you using dbt with?
The output of
dbt --version
:Are you interested in contributing the fix?
I'll open a PR for this. The most time-consuming part will be modifying the integration tests.
Simple fix is described here:
This fix is verified to work as described in my local environment.