Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bytebase/snowsql-parser
Snowflake parser on ANTLR4
https://github.com/bytebase/snowsql-parser
antlr antlr-parser antlr4 database parser snowflake sql
Last synced: 8 days ago
JSON representation
Snowflake parser on ANTLR4
- Host: GitHub
- URL: https://github.com/bytebase/snowsql-parser
- Owner: bytebase
- License: apache-2.0
- Created: 2023-06-04T02:16:31.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-11T02:45:54.000Z (23 days ago)
- Last Synced: 2024-12-25T06:02:46.578Z (9 days ago)
- Topics: antlr, antlr-parser, antlr4, database, parser, snowflake, sql
- Language: ANTLR
- Homepage: https://www.bytebase.com
- Size: 4.27 MB
- Stars: 2
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
The plsql-parser is a parser for Snowflake. It is based on the [ANTLR4](https://github.com/antlr/antlr4) and use the grammar from [antlr4-grammars-plsql](https://github.com/antlr/grammars-v4/tree/master/sql/snowflake).
## Build
Before build, you need to install the ANTLR4.
requirements:
- https://github.com/antlr/antlr4/blob/master/doc/getting-started.md
- https://github.com/antlr/antlr4/blob/master/doc/go-target.md```bash
./build.sh
```## Update grammar
### Manually change the grammar file in this project
1. run `./build.sh` to generate the parser code.
### From antlr4-grammars-plsql
1. Clone the `SnowflakeLexer.g4` and `SnowflakeParser.g4` grammar files from https://github.com/antlr/grammars-v4/tree/master/sql/snowflake.
1. run `./build.sh` to generate the parser code.## Test the parser
Run `TestSnowflakeSQLParser` in `parser_test.go` to test the parser.
```bash
go test -v
```## References
- ANTLR4 Getting Started https://github.com/antlr/antlr4/blob/master/doc/getting-started.md
- ANTLR4 Go Garget https://github.com/antlr/antlr4/blob/master/doc/go-target.md