The package provides a parser for trino queries.
To install the package run:
pip install trino-query-parser>>> from trino_query_parser import parse_statement
>>> parse_statement('select * from x.y')
[['SELECT', '*', 'FROM', ['X', '.', 'Y']], '<EOF>']trino-query-parser uses trino antlr4 grammar to generate python parser code.
If you care about specific version of trino, install the corresponding version of trino-query-parser.
For example, for trino-405 run:
pip install trino-query-parser~=0.405.0If there is no such version, feel free to open an issue.
Warning
Be careful, API is not stable, it might change in new versions
To generate antlr4 parser code run:
make generate-codeTo install development dependencies run:
pip install -e .[test]