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

fix: Escape String for AS in external table #580

Merged
merged 1 commit into from
Jun 17, 2021

Conversation

alldoami
Copy link
Contributor

Addresses: #542

Test Plan

  • acceptance tests

References

@alldoami alldoami requested a review from a team as a code owner June 17, 2021 01:40
@alldoami alldoami requested a review from edulop91 June 17, 2021 01:40
@github-actions
Copy link

Integration tests success for c304eebd5fd0747d911c8766538fabcbc853d934

@@ -113,7 +113,7 @@ func (tb *ExternalTableBuilder) Create() string {
q.WriteString(fmt.Sprintf(` (`))
columnDefinitions := []string{}
for _, columnDefinition := range tb.columns {
columnDefinitions = append(columnDefinitions, fmt.Sprintf(`"%v" %v AS %v`, EscapeString(columnDefinition["name"]), EscapeString(columnDefinition["type"]), EscapeString(columnDefinition["as"])))
columnDefinitions = append(columnDefinitions, fmt.Sprintf(`"%v" %v AS %v`, EscapeString(columnDefinition["name"]), EscapeString(columnDefinition["type"]), columnDefinition["as"]))

Choose a reason for hiding this comment

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

I wonder if a more sustainable fix is to make it so that you can do columnDefinition.Get("name") and it'll return behind the scenes EscapeString(columnDefinition["name"])

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm columnDefinition is a map of strings so there's no Get method.

Choose a reason for hiding this comment

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

it is now, but it doesn't have to be. I don't think you should make that change in the PR though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ohhh you were saying to change the structure of columnDefinitions so that we could use Get...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What would the difference be from what I changed it to?

@alldoami alldoami merged commit 3954741 into main Jun 17, 2021
@alldoami alldoami deleted the adoami/fix-escape-string-external-table branch June 17, 2021 17:18
jtzero pushed a commit to rxrevu/terraform-provider-snowflake that referenced this pull request Aug 19, 2021
anton-chekanov pushed a commit to anton-chekanov/terraform-provider-snowflake that referenced this pull request Jan 25, 2022
daniepett pushed a commit to daniepett/terraform-provider-snowflake that referenced this pull request Feb 9, 2022
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.

2 participants