Skip to content

[BUG] Columns are not quoted during compilations #259

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

Open
quavu997 opened this issue Apr 4, 2025 · 0 comments
Open

[BUG] Columns are not quoted during compilations #259

quavu997 opened this issue Apr 4, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@quavu997
Copy link

quavu997 commented Apr 4, 2025

Issue
Currently facing issue during compilation of staging view. It is due to a source column named 'START' (which is a reserved keyword in snowflake). So my steps were to escape this column using the derived columns function in staging.
However, I'm still facing the error because while it is compiling, the final 'START' column is not wrapped in quotes. Please see below sample for details.

I'm thinking this might be a bug because according to the old dbtvault page (https://automate-dv.readthedocs.io/en/v0.9.0/macros/stage_macro_configurations/#escaping-column-names-that-are-not-sql-compliant), dbt will quotes all columns when generating the SQL. But when compared to the newer documentation page (https://automate-dv.readthedocs.io/en/stable/macros/stage_macro_configurations/#escaping-column-names-that-are-not-sql-compliant), I can see that the generated SQL no longer contains columns wrapped in double quotes.

Sample:

In Load model, I have added double quote to "START". Note that running the load model works, but not the Stage model.

...
TO_DATE("START", 'MM-DD-YYYY') "START",
...

In Stage model, I added the escape logic.

derived_columns:
   START:
     source_column: "START"
     escape: true

Environment

dbt version: v1.7
automate_dv version: 0.9.7
Database/Platform: Snowflake

The result in the compiled log:

with derived_columns (
...
"START" AS START
FROM source_model
)

What I want to achieve is:

with derived_columns (
...
"START" AS "START"
FROM source_model
)

Thanks.

AB#5704

@quavu997 quavu997 added the bug Something isn't working label Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants