-
Notifications
You must be signed in to change notification settings - Fork 153
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
quoting of column names in nested fields #71
Comments
@philipp-heinrich Sure, this makes sense to me! There's no downside (that I'm aware of) to quoting quite aggressively on BigQuery. It sounds like you already found the spot in the code where the change would need to happen. I'm going to mark this a |
I'd be happy to contribute this change as well @philipp-heinrich (if you weren't planning to, let me know) :) @jtcohen6 Quick question for you. I found instances of However it seems like in this BigQuery adapter (and I also checked the spark adapter) there is only a |
The dbt-bigquery/dbt/adapters/bigquery/impl.py Lines 319 to 321 in 69f5cbf
Unfortunately, the naming here is pretty confusing:
dbt-bigquery/dbt/adapters/bigquery/column.py Lines 75 to 77 in 69f5cbf
|
thanks @DigUpTheHatchet - i haven't had time yet, feel free to contribute. Let me know when you have something, so i can test it locally too. |
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue, or it will be closed in 7 days. |
Describe the bug
the column type is overridden as a BigQueryColumn in BigQuery dbt projects
However, column names in nested fields are not quoted, which is ok for most coloums. However, in cases where reserved keywords are used as column names, the SQL code becomes invalid.
In order to circumvent this issue, all columns should be quoted.
There is already a function called "quoted".
In my opinion, line 86 should be changed, so that column names are quoted.
Steps To Reproduce
We encoutered the issue, when running the
dbt_utils.union_relations
makro, which joined multiple nested tables, which had coloum names such asfrom
andwhere
deeply in their nested field structure.Expected behavior
All column names (including the ones from nested fields) should be quoted, in order to prevent issues with reserved Keywords
Screenshots and log output
System information
The output of
dbt --version
:The operating system you're using:
Ubuntu
The output of
python --version
:Python 3.8.10
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: