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

Backslahes in comments should be escaped #2290

Closed
plaflamme opened this issue Mar 16, 2024 · 3 comments · Fixed by #2307
Closed

Backslahes in comments should be escaped #2290

plaflamme opened this issue Mar 16, 2024 · 3 comments · Fixed by #2307
Assignees
Labels
Bug Something isn't working Engine: BigQuery issues related to BigQuery

Comments

@plaflamme
Copy link
Contributor

I had a model like this:

/* This is the comment with a \ in it */
MODEL(
  name foo.bar
);
SELECT * FROM baz

Results in the following error in BigQuery:

google.api_core.exceptions.BadRequest: 400 Syntax error: Illegal escape sequence: \  at [1:2231]; reason: invalidQuery, location: query, message: Syntax error: Illegal escape sequence: \  at [1:2231]
@tobymao
Copy link
Contributor

tobymao commented Mar 16, 2024

What happens if you add your own escape?

@plaflamme
Copy link
Contributor Author

It works: it results in a \ in the BigQuery description of the table.

Though I think my point is that such a comment is perfectly fine in BigQuery. I believe that the reason it breaks is because the comment has to be transported through the API which requires escaping some characters.

For example, it's already escaping single quotes:

`my_column` STRING OPTIONS (description='The column\'s description')

So presumably, it should also be escaping backslashes...

@tobymao
Copy link
Contributor

tobymao commented Mar 16, 2024

@treysp

@izeigerman izeigerman added Bug Something isn't working Engine: BigQuery issues related to BigQuery labels Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Engine: BigQuery issues related to BigQuery
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants