#incremental #parsing #sql #bigquery #tree-sitter

tree-sitter-sql-bigquery

BigQuery SQL grammar for the tree-sitter parsing library

12 releases

0.1.5 Dec 1, 2022
0.1.4 Nov 30, 2022
0.0.22 Oct 19, 2022
0.0.17 Sep 4, 2022
0.0.8 Jun 26, 2022

#144 in Parser tooling

Download history 34/week @ 2022-08-17 10/week @ 2022-08-24 17/week @ 2022-08-31 14/week @ 2022-09-07 4/week @ 2022-09-14 1/week @ 2022-09-21 3/week @ 2022-09-28 9/week @ 2022-10-05 32/week @ 2022-10-19 4/week @ 2022-10-26 3/week @ 2022-11-02 1/week @ 2022-11-09 9/week @ 2022-11-16 56/week @ 2022-11-23 62/week @ 2022-11-30

129 downloads per month

MIT license

17MB
465K SLoC

C 463K SLoC JavaScript 1.5K SLoC // 0.0% comments C++ 277 SLoC // 0.0% comments Scheme 126 SLoC // 0.0% comments Rust 41 SLoC // 0.1% comments

Build/Test

tree-sitter for BigQuery's SQL

Portable BigQuery SQL Parser available in many programming language such as Rust, Node and so on.

This project supports StandardSQL in BigQuery. 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 SQL 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 = "";
let mut parser = tree_sitter::Parser::new();
parser.set_language(tree_sitter_sql_bigquery::language()).expect("Error loading SQL grammar");
let tree = parser.parse(code, None).unwrap();

Dependencies

~1.4–2MB
~52K SLoC