#tree-sitter #sql-parser #sql #big-query #parser #incremental

tree-sitter-sql-bigquery

BigQuery SQL grammar for the tree-sitter parsing library

28 releases

new 0.7.0 May 12, 2024
0.6.0 Oct 11, 2023
0.5.0 Aug 13, 2023
0.4.2 Jul 29, 2023
0.0.8 Jun 26, 2022

#101 in Text editors

Download history 18/week @ 2024-01-30 296/week @ 2024-02-06 72/week @ 2024-02-13 51/week @ 2024-02-20 45/week @ 2024-02-27 2/week @ 2024-03-26 71/week @ 2024-04-02 191/week @ 2024-04-09 25/week @ 2024-04-16 31/week @ 2024-04-30 117/week @ 2024-05-07

364 downloads per month

MIT license

33MB
887K SLoC

C 885K SLoC JavaScript 1.5K SLoC // 0.0% comments Scheme 117 SLoC // 0.0% comments Rust 32 SLoC // 0.1% comments

Build/Test

tree-sitter for GoogleSQL (SQL dialect in BigQuery)

GoogleSQL(formerly known as StandardSQL) parser available in many programming language such as Rust, Node and so on. You could try out the demo on Github Pages

References

Development

Running tests

npm install --also=dev
npm test

Debbuging

  • npm run parse <your sql file.sql> outputs a syntax tree

lib.rs:

This crate provides SqlBigquery language support for the tree-sitter parsing library.

Typically, you will use the language function to add this language to a tree-sitter Parser, and then use the parser to parse some code:

let code = r#"
"#;
let mut parser = tree_sitter::Parser::new();
parser.set_language(&tree_sitter_sql_bigquery::language()).expect("Error loading SqlBigquery grammar");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());

Dependencies

~2.7–4MB
~71K SLoC