Skip to main content

Module validation

Module validation 

Source
Expand description

Local validation for SQL sent by read-only BigQuery features.

Mirrors kumosql.sql_validation: a query must be exactly one read-only SELECT (with CTEs, subqueries, set operations or pipe operators), at most 20,000 characters, and nothing in its tree may write, define or run anything. Errors never echo the SQL or the parser’s excerpt.

Constants§

MAX_READONLY_QUERY_CHARS
The longest query (in characters) the read-only check accepts.

Functions§

quote_table_path
Quote a strict project.dataset.table path in backticks, refusing any SQL punctuation.
validate_readonly_query
Require exactly one read-only SELECT statement (CTEs, subqueries, set operations and pipe syntax allowed) of at most MAX_READONLY_QUERY_CHARS characters. Comments, and semicolons after the statement, are fine.
validate_readonly_query_with_max
validate_readonly_query with another bound on the text: max_chars characters. Features that store queries keep the 20,000 default; a one-off runner may allow more.