Skip to main content

Module printer

Module printer 

Source
Expand description

Deterministic SQL printer for the syntax tree.

to_sql and query_to_sql print clause per line with two-space indentation; to_sql_compact and expr_to_sql print on one line. Parsing printed SQL gives back an equal tree: parentheses are added only where precedence needs them, and every parenthesis the source had is kept as an Expr::Nested.

Functionsยง

data_type_to_sql
A data type (ARRAY<STRUCT<a INT64>>).
expr_to_sql
An expression on one line.
ident_to_sql
An identifier as GoogleSQL needs it written: quoted when it was, or when it must be.
object_name_to_sql
A dotted name.
query_to_sql
A query, laid out clause per line.
query_to_sql_compact
A query on one line.
row_pattern
A MATCH_RECOGNIZE pattern as written: alternation binds loosest, then concatenation, then quantifiers.
statements_to_sql
Statements separated by ; and a blank line, ending with ;.
table_factor_to_sql
A table factor on one line (`p.d.t` AS x).
to_sql
A statement, laid out clause per line.
to_sql_compact
A statement on one line.