https://github.com/grihabor/trino-query-parser
Provides a parser for trino queries
https://github.com/grihabor/trino-query-parser
presto presto-parser sql trino trino-parser
Last synced: 3 months ago
JSON representation
Provides a parser for trino queries
- Host: GitHub
- URL: https://github.com/grihabor/trino-query-parser
- Owner: grihabor
- Created: 2023-01-21T23:56:49.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-07-23T16:04:22.000Z (almost 2 years ago)
- Last Synced: 2025-01-14T06:47:57.138Z (5 months ago)
- Topics: presto, presto-parser, sql, trino, trino-parser
- Language: ANTLR
- Homepage:
- Size: 32.2 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
trino-query-parser
==================|pypi| |python|
.. |pypi| image:: https://img.shields.io/pypi/v/trino-query-parser
:alt: PyPI.. |python| image:: https://img.shields.io/pypi/pyversions/trino-query-parser
:alt: PyPI - Python VersionThe package provides a parser for trino queries.
Install
-------To install the package run:
.. code-block:: bash
pip install trino-query-parser
Example
-------.. code-block:: python3
>>> from trino_query_parser import parse_statement
>>> parse_statement('select * from x.y')
[['SELECT', '*', 'FROM', ['X', '.', 'Y']], '']Details
-------:code:`trino-query-parser` uses `trino antlr4 grammar `_ to generate python parser code.
If you care about specific version of :code:`trino`, install the corresponding version of :code:`trino-query-parser`.
For example, for :code:`trino-405` run:
.. code-block:: bash
pip install trino-query-parser~=0.405.0
If there is no such version, feel free to open an issue.
.. warning::
Be careful, API is not stable, it might change in new versions
Development
-----------To generate antlr4 parser code run:
.. code-block:: bash
make generate-code
To install development dependencies run:
.. code-block:: bash
pip install -e .[test]