shunping commented on PR #41886:
URL: https://github.com/apache/beam/pull/41886#issuecomment-7387299455
> Conceptual question: SQL query sanitization is a somewhat well-explored
problem at this point. Is rolling our own solution here the easiest option?
That's a good question. I did look at using BigQuery query parameters
(`bigquery.ScalarQueryParameter` / `QueryJobConfig`) instead, and prototyped
it. It works, but because `metadata_restriction_template` is a free-form SQL
fragment with quoted placeholders (e.g. language = '{language}'), it doesn't
remove the parsing. In the prototype this ended up as more code than the
current change, with more edge cases to maintain (e.g. placeholders inside a
long literal, unquoted placeholders, etc).
The current approach is limited to string literals (escape the value inside
quotes; unquoted values must be numbers or booleans; anything ambiguous
raises), and is covered by unit tests. So I'd prefer to keep it here.
Do you have anything else in mind that you suggest I can try?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]