Skip to main content

Crate kumosql_sql

Crate kumosql_sql 

Source
Expand description

BigQuery / GoogleSQL language support for KumoSQL-Rust.

  • token: the lexer (strings, raw/bytes prefixes, quoted names, numbers, comments, operators).
  • ast: the syntax tree, with traversal helpers.
  • parser: a recursive-descent parser for statements, queries, pipe syntax and expressions.
  • printer: a deterministic printer whose output parses back to an equal tree.
  • formatting: the formatter (comments kept, meaning checked) and structural complexity scoring.
  • validation: the read-only query check and strict table path quoting.
  • sqlx: Dataform SQLX sections, config blocks, interpolation masking and restoring.
  • scripts: BigQuery script splitting and data-flow analysis (temp tables, variables, MERGE, procedures).
  • js: plain data read out of Dataform JavaScript without running it.

Re-exports§

pub use error::Result;
pub use error::SqlError;
pub use formatting::complexity;
pub use formatting::format_sql;
pub use formatting::Complexity;
pub use formatting::ComplexityBand;
pub use formatting::FormatPreferences;
pub use parser::parse_data_type;
pub use parser::parse_expr;
pub use parser::parse_query;
pub use parser::parse_script;
pub use parser::parse_statement;
pub use parser::parse_statements;
pub use printer::expr_to_sql;
pub use printer::query_to_sql;
pub use printer::to_sql;
pub use printer::to_sql_compact;
pub use scripts::analyse_script;
pub use scripts::split_script;
pub use scripts::ScriptAnalysis;
pub use scripts::ScriptStatement;
pub use sqlx::decode_sqlx_bytes;
pub use sqlx::looks_like_sqlx;
pub use sqlx::mask_sqlx;
pub use sqlx::parse_sqlx_config;
pub use sqlx::restore_sqlx;
pub use sqlx::split_sqlx_sections;
pub use sqlx::MaskedSqlx;
pub use sqlx::RefCall;
pub use sqlx::SqlxConfig;
pub use sqlx::SqlxSection;
pub use token::tokenize;
pub use token::tokenize_with_trivia;
pub use token::Span;
pub use token::Token;
pub use token::TokenKind;
pub use validation::quote_table_path;
pub use validation::validate_readonly_query;
pub use validation::validate_readonly_query_with_max;
pub use ast::*;

Modules§

ast
The GoogleSQL (BigQuery) syntax tree.
error
Errors raised by the lexer, parser, formatter, validator and SQLX helpers.
formatting
SQL formatting and structural complexity scoring.
js
Read plain data out of Dataform JavaScript without running it.
parser
Recursive-descent parser for GoogleSQL (BigQuery) statements, queries and expressions.
printer
Deterministic SQL printer for the syntax tree.
scripts
BigQuery scripts: break them into statements and follow what flows between them.
sqlx
Dataform SQLX handling shared by every reader and rewrite.
token
GoogleSQL (BigQuery) lexer.
validation
Local validation for SQL sent by read-only BigQuery features.