Backslahes in comments should be escaped
plaflamme opened this issue · comments
Philippe Laflamme commented
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]
Toby Mao commented
What happens if you add your own escape?
Philippe Laflamme commented
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...