This release is a pre-release and may not be stable for production use.
sqlgpt-parser
sqlgpt-parser is a Python implementation of an SQL parser that effectively converts SQL statements into Abstract Syntax Trees (AST). By leveraging AST tree comparisons between two SQL queries, it becomes possible to achieve robust evaluation of text-to-SQL models.
Quick Start
Install
pip install sqlgpt-parser
Parser SQL
>> > from sqlgpt_parser.parser.mysql_parser import parser as mysql_parser
>> > mysql_parser.parse("select * from t")
Query(query_body=QuerySpecification(select=Select(distinct=False, select_items=[
SingleColumn(expression=QualifiedNameReference(name=QualifiedName.of("*")))]),
from_=Table(name=QualifiedName.of("t"), for_update=False), order_by=[], limit=0,
offset=0, for_update=False, nowait_or_wait=False), order_by=[], limit=0, offset=0)
>> > from sqlgpt_parser.parser.oceanbase_parser import parser as oceanbase_parser
>> > oceanbase_parser.parse("select * from t")
Query(query_body=QuerySpecification(select=Select(distinct=False, select_items=[
SingleColumn(expression=QualifiedNameReference(name=QualifiedName.of("*")))]),
from_=Table(name=QualifiedName.of("t"), for_update=False), order_by=[], limit=0,
offset=0, for_update=False, nowait_or_wait=False), order_by=[], limit=0, offset=0)
>> > from sqlgpt_parser.parser.odps_parser import parser as odps_parser
>> > odps_parser.parse("select * from t")
Query(query_body=QuerySpecification(select=Select(distinct=False, select_items=[
SingleColumn(expression=QualifiedNameReference(name=QualifiedName.of("*")))]),
from_=Table(name=QualifiedName.of("t"), for_update=False), order_by=[], limit=0,
offset=0, for_update=False, nowait_or_wait=False), order_by=[], limit=0, offset=0)
Format SQL
>>> from sqlgpt_parser.format.formatter import format_sql
>>> from sqlgpt_parser.parser.mysql_parser import parser
>>> result=parser.parse("select * from t")
>>> format_sql(result)
'SELECT\n *\nFROM\n t'
Getting Started with SQL Parser Development
English Document: SQL Parser Development Guide
中文文档:SQL Parser 开发指南
Metadata
Release files for sqlgpt-parser 0.0.1a5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sqlgpt_parser-0.0.1a5.tar.gz | 2.5 MB | Without provenance | Details for sqlgpt_parser-0.0.1a5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sqlgpt_parser-0.0.1a5-py3-none-any.whl | Python 3 | none | any | Details for sqlgpt_parser-0.0.1a5-py3-none-any.whl |
Total release size: 5.2 MB
Release files / sqlgpt_parser-0.0.1a5.tar.gz
| Download URL | sqlgpt_parser-0.0.1a5.tar.gz |
|---|---|
| Size | 2.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7dfc00209b6908f0fcb9aa064333fb1848996295cf6ee2ac72004a18f13a3e7f
|
|
BLAKE2b-256 checksum How to use checksums |
f051743ee5859f6b1a6bfbb0765e130638b3fec8982c6f766e9a82d1464afcc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / sqlgpt_parser-0.0.1a5-py3-none-any.whl
| Download URL | sqlgpt_parser-0.0.1a5-py3-none-any.whl |
|---|---|
| Size | 2.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d7e81875c2b120bee3545f47c544e1adce72cc7963690b02d7c34e5cf682fe6c
|
|
BLAKE2b-256 checksum How to use checksums |
6998feda6c07971fb1006bd8119601b12c85e5157c54c00e4c65fc147a3f0d97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Security for sqlgpt-parser 0.0.1a5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.