Crate mz_sql_parser

source ·
Expand description

SQL parser.

This crate provides an SQL lexer and parser for Materialize’s dialect of SQL.

use mz_sql_parser::parser;

let sql = "SELECT a, b, 123, myfunc(b) \
           FROM table_1 \
           WHERE a > b AND b < 100 \
           ORDER BY a DESC, b";

let ast = parser::parse_statements(sql).unwrap();
println!("AST: {:?}", ast);


  • SQL Abstract Syntax Tree (AST) types
  • SQL Parser


  • A macro that creates an Ident from a string literal, validating all of our invariants at compile time.