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

[bigquery] Escape all columns that do not start with "__artie" #514

Merged
merged 5 commits into from
Apr 29, 2024

Conversation

nathan-artie
Copy link
Contributor

@nathan-artie nathan-artie commented Apr 29, 2024

Since BigQuery does not change the case of identifiers when they are not quoted we should be able to always quote column identifiers. This is based on #501 but BigQuery instead of MS SQL.

} else if destKind == constants.MSSQL {
return !strings.HasPrefix(name, constants.ArtiePrefix)
} else if destKind == constants.MSSQL || destKind == constants.BigQuery {
if !strings.HasPrefix(name, constants.ArtiePrefix) {
Copy link
Contributor Author

@nathan-artie nathan-artie Apr 29, 2024

Choose a reason for hiding this comment

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

I changed this so that in the case that the name does start with constants.ArtiePrefix we don't immediately return so that we still run the logic for checking symbolsToEscape.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why do that? There should never be reserved keywords that have the Artie prefix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So that __artie_foo:bar still gets escaped.

@nathan-artie nathan-artie marked this pull request as ready for review April 29, 2024 19:20
@nathan-artie nathan-artie requested a review from Tang8330 April 29, 2024 19:20
@nathan-artie nathan-artie merged commit 5b9d6c7 into master Apr 29, 2024
1 check passed
@nathan-artie nathan-artie deleted the nv/bq-almost-always-quote-columns branch April 29, 2024 20:25
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