google's bigquery system states identifiers must meet , regular-expression syntax, specifically, [a-za-z_][a-za-z_0-9]* (as indicated here: https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical). in addition, while not explicitly stated, there length limitation well. finally, identifiers cannot match existing keywords.
i want generate sql queries based on user-input, want validate queries before submitting them. can cheat , back-tick attribute names, query can simple, prefer keep simple.
it's simple enough me check against regular-expression , possible length limitation, checking against keyword list requires have up-to-date keyword list in hand.
so 2 questions:
- is there existing library can use check attribute name, or perhaps whole query? 
- if cannot have first item, can publicly maintained list of keywords? (yes, yes, can scrape myself language spec, answer out of date next time google adds new feature). 
i targeting bigquery "standard" sql rather "legacy" sql.
..or perhaps whole query?
yes, use dryrun flag in request. query not run, checked if it's syntactically correct.
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#dryrun
the error should contain why query invalid.

Comments
Post a Comment