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

Quoted column identifiers #153

Closed

Conversation

dhwdeca
Copy link

@dhwdeca dhwdeca commented Jun 30, 2023

Closes #141

Comment on lines 71 to 75
{%- if options.quoted_columns %}
"{{ column }}"
{%- else %}
{{ column }}
{%- endif %}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm new here, and was browsing the open PRs, but this seems pretty snowflake specific -- does it make sense to use the quote_identifier macro here?

It sounds like capitalized identifiers are valid, and that would dispatch to snowflake__quote_identifier which surrounds the column name in double quotes and capitalizes it:

return('"' ~ identifier | upper ~ '"')

This would let users of the library override the behaviour in their projects if needed.

Copy link
Author

@dhwdeca dhwdeca Aug 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment, Nick. You make a good point.
Coincidentally I was having the exact same conversation at a hackathon last night.

I will be updating this to a more generic/technology agnostic implementation.

EDIT: Updated it, using the quote_identifier, but I extended it with an optional preserve_case argument, as the capitalization is the thing I specifically didn't want in Snowflake.

@cdiniz cdiniz added the safe to test Label used to identify prs safe to test on the integration environments label Nov 11, 2023
@github-actions github-actions bot removed the safe to test Label used to identify prs safe to test on the integration environments label Nov 11, 2023
@Tideorz
Copy link

Tideorz commented Nov 21, 2023

@cdiniz , could this be merged into main? We also have the same problem for column needs quote

@dhwdeca dhwdeca force-pushed the quoted-column-identifiers branch from a9f8aac to 6b55b76 Compare December 8, 2023 08:24
@dhwdeca dhwdeca closed this Dec 22, 2023
@dhwdeca dhwdeca deleted the quoted-column-identifiers branch December 22, 2023 12:56
@dhwdeca
Copy link
Author

dhwdeca commented Dec 22, 2023

Hi All,
With some of the latest commits, the way I implemented this no longer worked.
I've taken a different approach and opened a new merge request: #194
Feel free to return to the discussion there and push to give this some attention so we can get this included in the main release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Snowflake SQL compilation error with quoted column names
4 participants