{"id":13570997,"url":"https://github.com/eosphoros-ai/sqlgpt-parser","last_synced_at":"2025-06-26T21:33:42.697Z","repository":{"id":192701450,"uuid":"685352333","full_name":"eosphoros-ai/sqlgpt-parser","owner":"eosphoros-ai","description":"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.","archived":false,"fork":false,"pushed_at":"2025-04-14T05:47:15.000Z","size":12284,"stargazers_count":30,"open_issues_count":2,"forks_count":11,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-28T03:22:40.938Z","etag":null,"topics":["ast","nl-to-sql","parser","python","sql","text-to-sql"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eosphoros-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-08-31T03:30:38.000Z","updated_at":"2025-05-14T11:27:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"7c920d31-d432-4b63-9fea-057d467f6f70","html_url":"https://github.com/eosphoros-ai/sqlgpt-parser","commit_stats":null,"previous_names":["eosphoros-ai/sqlgpt-parser"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/eosphoros-ai/sqlgpt-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eosphoros-ai%2Fsqlgpt-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eosphoros-ai%2Fsqlgpt-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eosphoros-ai%2Fsqlgpt-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eosphoros-ai%2Fsqlgpt-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eosphoros-ai","download_url":"https://codeload.github.com/eosphoros-ai/sqlgpt-parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eosphoros-ai%2Fsqlgpt-parser/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262145201,"owners_count":23265892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","nl-to-sql","parser","python","sql","text-to-sql"],"created_at":"2024-08-01T14:00:57.347Z","updated_at":"2025-06-26T21:33:42.671Z","avatar_url":"https://github.com/eosphoros-ai.png","language":"Python","readme":"# sqlgpt-parser\n\nsqlgpt-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.\n\n## Quick Start\n\n### Install\n```sh\npip install sqlgpt-parser\n```\n### Parser SQL\n\n```python\n\u003e\u003e \u003e from sqlgpt_parser.parser.mysql_parser import parser as mysql_parser\n\u003e\u003e \u003e mysql_parser.parse(\"select * from t\")\nQuery(query_body=QuerySpecification(select=Select(distinct=False, select_items=[\n    SingleColumn(expression=QualifiedNameReference(name=QualifiedName.of(\"*\")))]),\n                                    from_=Table(name=QualifiedName.of(\"t\"), for_update=False), order_by=[], limit=0,\n                                    offset=0, for_update=False, nowait_or_wait=False), order_by=[], limit=0, offset=0)\n\u003e\u003e \u003e from sqlgpt_parser.parser.oceanbase_parser import parser as oceanbase_parser\n\u003e\u003e \u003e oceanbase_parser.parse(\"select * from t\")\nQuery(query_body=QuerySpecification(select=Select(distinct=False, select_items=[\n    SingleColumn(expression=QualifiedNameReference(name=QualifiedName.of(\"*\")))]),\n                                    from_=Table(name=QualifiedName.of(\"t\"), for_update=False), order_by=[], limit=0,\n                                    offset=0, for_update=False, nowait_or_wait=False), order_by=[], limit=0, offset=0)\n\u003e\u003e \u003e from sqlgpt_parser.parser.odps_parser import parser as odps_parser\n\u003e\u003e \u003e odps_parser.parse(\"select * from t\")\nQuery(query_body=QuerySpecification(select=Select(distinct=False, select_items=[\n    SingleColumn(expression=QualifiedNameReference(name=QualifiedName.of(\"*\")))]),\n                                    from_=Table(name=QualifiedName.of(\"t\"), for_update=False), order_by=[], limit=0,\n                                    offset=0, for_update=False, nowait_or_wait=False), order_by=[], limit=0, offset=0)\n```\n\n### Format SQL\n```python\n\u003e\u003e\u003e from sqlgpt_parser.format.formatter import format_sql\n\u003e\u003e\u003e from sqlgpt_parser.parser.mysql_parser import parser\n\u003e\u003e\u003e result=parser.parse(\"select * from t\")\n\u003e\u003e\u003e format_sql(result)\n'SELECT\\n  *\\nFROM\\n  t'\n\n```\n## Getting Started with SQL Parser Development\n\nEnglish Document: [SQL Parser Development Guide](https://github.com/eosphoros-ai/sqlgpt-parser/blob/main/docs/docs-en/SQL%20Parser%20Development%20Guide.md)\n\n中文文档：[SQL Parser 开发指南](https://github.com/eosphoros-ai/sqlgpt-parser/blob/main/docs/docs-ch/SQL%20Parser%20%E5%BC%80%E5%8F%91%E6%8C%87%E5%8D%97.md)","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feosphoros-ai%2Fsqlgpt-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feosphoros-ai%2Fsqlgpt-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feosphoros-ai%2Fsqlgpt-parser/lists"}