From 99a043b4904df654948d6e667e49cbb6059847c2 Mon Sep 17 00:00:00 2001 From: tomato <1083369179@qq.com> Date: Fri, 8 Sep 2023 12:58:27 +0800 Subject: [PATCH] rename sql_parser to parser -s --- README.md | 27 ++++++++----- ...00\345\217\221\346\214\207\345\215\227.md" | 6 +-- docs/docs-en/SQL Parser Development Guide.md | 6 +-- pyproject.toml | 8 ++-- sqlgpt_parser/__init__.py | 12 ++++++ sqlgpt_parser/format/formatter.py | 14 +++---- .../mysql_parser => parser}/__init__.py | 0 .../{sql_parser => parser}/exceptions.py | 0 .../mysql_parser}/__init__.py | 0 .../mysql_parser/lexer.py | 2 +- .../mysql_parser/parser.py | 40 +++++++++---------- .../mysql_parser/parser_table.py | 0 .../mysql_parser/reserved.py | 0 .../oceanbase_parser}/__init__.py | 0 .../oceanbase_parser/lexer.py | 2 +- .../oceanbase_parser/parser.py | 40 +++++++++---------- .../oceanbase_parser/parser_table.py | 0 .../oceanbase_parser/reserved.py | 0 .../odps_parser}/__init__.py | 1 - .../odps_parser/lexer.py | 2 +- .../odps_parser/parser.py | 40 +++++++++---------- .../odps_parser/parser_table.py | 0 .../odps_parser/reserved.py | 0 .../{sql_parser => parser}/parser_utils.py | 10 ++--- .../{sql_parser => parser}/tree/__init__.py | 0 .../tree/approximate.py | 0 .../tree/call_argument.py | 0 .../{sql_parser => parser}/tree/explain.py | 0 .../{sql_parser => parser}/tree/expression.py | 0 .../{sql_parser => parser}/tree/field_type.py | 0 .../{sql_parser => parser}/tree/grouping.py | 0 .../{sql_parser => parser}/tree/index_type.py | 0 .../tree/join_criteria.py | 0 .../{sql_parser => parser}/tree/literal.py | 0 .../{sql_parser => parser}/tree/node.py | 0 .../tree/qualified_name.py | 0 .../tree/query_specification.py | 0 .../{sql_parser => parser}/tree/relation.py | 0 .../{sql_parser => parser}/tree/rewrite.py | 0 .../{sql_parser => parser}/tree/select.py | 0 .../tree/select_item.py | 0 .../tree/set_operation.py | 0 .../{sql_parser => parser}/tree/sort_item.py | 0 .../{sql_parser => parser}/tree/statement.py | 0 .../{sql_parser => parser}/tree/table.py | 0 .../tree/table_element.py | 0 .../tree/transaction.py | 0 .../{sql_parser => parser}/tree/values.py | 0 .../{sql_parser => parser}/tree/visitor.py | 0 .../{sql_parser => parser}/tree/window.py | 0 .../{sql_parser => parser}/tree/with_stmt.py | 0 test/format/test_sql_formatter.py | 2 +- test/parser/test_parser_ddl.py | 2 +- test/parser/test_parser_dml.py | 10 ++--- test/parser/test_parser_dql.py | 14 +++---- 55 files changed, 129 insertions(+), 109 deletions(-) rename sqlgpt_parser/{sql_parser/mysql_parser => parser}/__init__.py (100%) rename sqlgpt_parser/{sql_parser => parser}/exceptions.py (100%) rename sqlgpt_parser/{sql_parser/oceanbase_parser => parser/mysql_parser}/__init__.py (100%) rename sqlgpt_parser/{sql_parser => parser}/mysql_parser/lexer.py (98%) rename sqlgpt_parser/{sql_parser => parser}/mysql_parser/parser.py (98%) rename sqlgpt_parser/{sql_parser => parser}/mysql_parser/parser_table.py (100%) rename sqlgpt_parser/{sql_parser => parser}/mysql_parser/reserved.py (100%) rename sqlgpt_parser/{sql_parser/odps_parser => parser/oceanbase_parser}/__init__.py (100%) rename sqlgpt_parser/{sql_parser => parser}/oceanbase_parser/lexer.py (97%) rename sqlgpt_parser/{sql_parser => parser}/oceanbase_parser/parser.py (98%) rename sqlgpt_parser/{sql_parser => parser}/oceanbase_parser/parser_table.py (100%) rename sqlgpt_parser/{sql_parser => parser}/oceanbase_parser/reserved.py (100%) rename sqlgpt_parser/{sql_parser => parser/odps_parser}/__init__.py (87%) rename sqlgpt_parser/{sql_parser => parser}/odps_parser/lexer.py (97%) rename sqlgpt_parser/{sql_parser => parser}/odps_parser/parser.py (98%) rename sqlgpt_parser/{sql_parser => parser}/odps_parser/parser_table.py (100%) rename sqlgpt_parser/{sql_parser => parser}/odps_parser/reserved.py (100%) rename sqlgpt_parser/{sql_parser => parser}/parser_utils.py (97%) rename sqlgpt_parser/{sql_parser => parser}/tree/__init__.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/approximate.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/call_argument.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/explain.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/expression.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/field_type.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/grouping.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/index_type.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/join_criteria.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/literal.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/node.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/qualified_name.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/query_specification.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/relation.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/rewrite.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/select.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/select_item.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/set_operation.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/sort_item.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/statement.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/table.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/table_element.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/transaction.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/values.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/visitor.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/window.py (100%) rename sqlgpt_parser/{sql_parser => parser}/tree/with_stmt.py (100%) diff --git a/README.md b/README.md index ffe8dfb..6fb78fb 100644 --- a/README.md +++ b/README.md @@ -11,15 +11,24 @@ pip install sqlgpt-parser ### Parser SQL ```python ->>> from sqlgpt_parser.sql_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.sql_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.sql_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) +>> > 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 diff --git "a/docs/docs-ch/SQL Parser \345\274\200\345\217\221\346\214\207\345\215\227.md" "b/docs/docs-ch/SQL Parser \345\274\200\345\217\221\346\214\207\345\215\227.md" index e506895..954d87f 100644 --- "a/docs/docs-ch/SQL Parser \345\274\200\345\217\221\346\214\207\345\215\227.md" +++ "b/docs/docs-ch/SQL Parser \345\274\200\345\217\221\346\214\207\345\215\227.md" @@ -2,7 +2,7 @@ `parser` 是 `sqlgpt-parser` 的基础模块,它将 SQL 语句按照预定义 SQL 语法规则解析,从文本转换成抽象语法树(`AST`)。 - `sqlgpt-parser` 的 `parser` 基于 [PLY](https://github.com/dabeaz/ply) 编写。PLY 是一个用于构建词法和语法分析器的 Python 工具。它能够根据指定的模式对输入的文本进行分析,它会在程序运行之前,自动编译项目 [sql-parser](../../sqlgpt_parser/sql_parser/) 文件夹下的词法规则和语法规则文件,生成可执行代码。 + `sqlgpt-parser` 的 `parser` 基于 [PLY](https://github.com/dabeaz/ply) 编写。PLY 是一个用于构建词法和语法分析器的 Python 工具。它能够根据指定的模式对输入的文本进行分析,它会在程序运行之前,自动编译项目 [sql-parser](../../sqlgpt_parser/parser/) 文件夹下的词法规则和语法规则文件,生成可执行代码。 ## 词法解析与语法解析 @@ -161,7 +161,7 @@ def p_expr_paren(p): ## `sqlgpt-parser`的 `parser` 实现 -`sqlgpt-parser` 中共有三个 SQL 语法解析器 ,分别在 [mysql_parser](../../sqlgpt_parser/sql_parser/mysql_parser)、 [oceanbase_parser](../../sqlgpt_parser/sql_parser/oceanbase_parser) 和 [odps_parser](../../sqlgpt_parser/sql_parser/odps_parser) 文件夹下,三个文件夹都包含`lexer.py`,`reserved.py`,`parser.py` 三个文件。 +`sqlgpt-parser` 中共有三个 SQL 语法解析器 ,分别在 [mysql_parser](../../sqlgpt_parser/parser/mysql_parser)、 [oceanbase_parser](../../sqlgpt_parser/parser/oceanbase_parser) 和 [odps_parser](../../sqlgpt_parser/parser/odps_parser) 文件夹下,三个文件夹都包含`lexer.py`,`reserved.py`,`parser.py` 三个文件。 `lexer.py` 和`reserved.py` 文件都用于词法解析。`reserved.py` 中定义了 SQL 的关键字,关键字定义在`reserved` 和 `nonreserved` 两个变量中 ,`reserved` 里面包含了所有 `sql` 中不可用作列名、表名或者别名的关键字,`nonreserved` 则是可以用作列名、表名或者别名的关键字。 @@ -260,7 +260,7 @@ def p_delete(p): 完成语法规则的编写后就可以使用,该语法规则解析 `SQL` 语句,以 `mysql_parser` 为例。 ```python -from sqlgpt_parser.sql_parser.mysql_parser import parser as mysql_parser +from sqlgpt_parser.parser.mysql_parser import parser as mysql_parser sql = "DELETE FROM t WHERE a=1" result = mysql_parser.parse(sql) diff --git a/docs/docs-en/SQL Parser Development Guide.md b/docs/docs-en/SQL Parser Development Guide.md index 8881684..694e18b 100644 --- a/docs/docs-en/SQL Parser Development Guide.md +++ b/docs/docs-en/SQL Parser Development Guide.md @@ -2,7 +2,7 @@ The `parser` module is the foundational module of `sqlgpt-parser`. It parses SQL statements according to predefined SQL grammar rules, converting them from text into an abstract syntax tree (`AST`). -The `parser` module in `sqlgpt-parser` is written using [PLY](https://github.com/dabeaz/ply). PLY is a Python tool for building lexical and parsing analyzers. It can analyze input text based on specified patterns and automatically compile the lexical and grammar rule files in the [sql-parser](../../sqlgpt_parser/sql_parser/) folder of the project before the program runs, generating executable code. +The `parser` module in `sqlgpt-parser` is written using [PLY](https://github.com/dabeaz/ply). PLY is a Python tool for building lexical and parsing analyzers. It can analyze input text based on specified patterns and automatically compile the lexical and grammar rule files in the [sql-parser](../../sqlgpt_parser/parser/) folder of the project before the program runs, generating executable code. ## Lexical Analysis and Syntax Analysis @@ -158,7 +158,7 @@ PLY uses the notation `p[position]` to access the stack, where `p[0]` correspond ## Implementation of the `parser` for `sqlgpt-parser` -There are a total of three SQL parsers in `sqlgpt-parser`, located in the [mysql_parser](../../sqlgpt_parser/sql_parser/mysql_parser), [oceanbase_parser](../../sqlgpt_parser/sql_parser/oceanbase_parser), and [odps_parser](../../sqlgpt_parser/sql_parser/odps_parser) folders. Each of these folders contains three files: `lexer.py`, `reserved.py`, and `parser.py`. +There are a total of three SQL parsers in `sqlgpt-parser`, located in the [mysql_parser](../../sqlgpt_parser/parser/mysql_parser), [oceanbase_parser](../../sqlgpt_parser/parser/oceanbase_parser), and [odps_parser](../../sqlgpt_parser/parser/odps_parser) folders. Each of these folders contains three files: `lexer.py`, `reserved.py`, and `parser.py`. The `lexer.py` and `reserved.py` files are both used for lexical analysis. In `reserved.py`, SQL keywords are defined and stored in two variables: `reserved` and `nonreserved`. The `reserved` variable contains all the keywords that cannot be used as column names, table names, or aliases in SQL. On the other hand, `nonreserved` contains keywords that can be used as column names, table names, or aliases. @@ -245,7 +245,7 @@ The comment in `p_delete` corresponds to the syntax rule for the `DELETE` statem Once the grammar rules are written, they can be used to parse SQL statements. Taking `mysql_parser` as an example, you can use this grammar rule for parsing SQL statements. ```python -from sqlgpt_parser.sql_parser.mysql_parser import parser as mysql_parser +from sqlgpt_parser.parser.mysql_parser import parser as mysql_parser sql = "DELETE FROM t WHERE a=1" result = mysql_parser.parse(sql) diff --git a/pyproject.toml b/pyproject.toml index 47d33d9..981118b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi" [project] name = "sqlgpt-parser" -version = "0.0.1a2" +version = "0.0.1a3" authors = [ { name="luliwjc", email="chenxiaoxi_wjc@163.com" }, { name="Ifffff", email="tingkai.ztk@antgroup.com" }, @@ -37,7 +37,7 @@ dependencies = [ [tool.black] skip-string-normalization = 1 force-exclude = ''' - src/sql_parser/mysql_parser/parser_table.py - | src/sql_parser/oceanbase_parser/parser_table.py - | src/sql_parser/odps_parser/parser_table.py + sqlgpt_parser/parser/mysql_parser/parser_table.py + | sqlgpt_parser/parser/oceanbase_parser/parser_table.py + | sqlgpt_parser/parser/odps_parser/parser_table.py ''' \ No newline at end of file diff --git a/sqlgpt_parser/__init__.py b/sqlgpt_parser/__init__.py index e69de29..e25d45f 100644 --- a/sqlgpt_parser/__init__.py +++ b/sqlgpt_parser/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +""" + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +""" +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sqlgpt_parser/format/formatter.py b/sqlgpt_parser/format/formatter.py index 5bb16f1..ca60733 100644 --- a/sqlgpt_parser/format/formatter.py +++ b/sqlgpt_parser/format/formatter.py @@ -9,13 +9,13 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. """ -from sqlgpt_parser.sql_parser.tree import JsonTableColumn -from sqlgpt_parser.sql_parser.tree.explain import ExplainFormat, ExplainType -from sqlgpt_parser.sql_parser.tree.grouping import SimpleGroupBy -from sqlgpt_parser.sql_parser.tree.join_criteria import JoinOn, JoinUsing, NaturalJoin -from sqlgpt_parser.sql_parser.tree.table import Table, TableSubquery -from sqlgpt_parser.sql_parser.tree.visitor import AstVisitor -from sqlgpt_parser.sql_parser.parser_utils import FIELD_REFERENCE_PREFIX +from sqlgpt_parser.parser.tree import JsonTableColumn +from sqlgpt_parser.parser.tree.explain import ExplainFormat, ExplainType +from sqlgpt_parser.parser.tree.grouping import SimpleGroupBy +from sqlgpt_parser.parser.tree.join_criteria import JoinOn, JoinUsing, NaturalJoin +from sqlgpt_parser.parser.tree.table import Table, TableSubquery +from sqlgpt_parser.parser.tree.visitor import AstVisitor +from sqlgpt_parser.parser.parser_utils import FIELD_REFERENCE_PREFIX class Formatter(AstVisitor): diff --git a/sqlgpt_parser/sql_parser/mysql_parser/__init__.py b/sqlgpt_parser/parser/__init__.py similarity index 100% rename from sqlgpt_parser/sql_parser/mysql_parser/__init__.py rename to sqlgpt_parser/parser/__init__.py diff --git a/sqlgpt_parser/sql_parser/exceptions.py b/sqlgpt_parser/parser/exceptions.py similarity index 100% rename from sqlgpt_parser/sql_parser/exceptions.py rename to sqlgpt_parser/parser/exceptions.py diff --git a/sqlgpt_parser/sql_parser/oceanbase_parser/__init__.py b/sqlgpt_parser/parser/mysql_parser/__init__.py similarity index 100% rename from sqlgpt_parser/sql_parser/oceanbase_parser/__init__.py rename to sqlgpt_parser/parser/mysql_parser/__init__.py diff --git a/sqlgpt_parser/sql_parser/mysql_parser/lexer.py b/sqlgpt_parser/parser/mysql_parser/lexer.py similarity index 98% rename from sqlgpt_parser/sql_parser/mysql_parser/lexer.py rename to sqlgpt_parser/parser/mysql_parser/lexer.py index 1d3f149..5f3859d 100644 --- a/sqlgpt_parser/sql_parser/mysql_parser/lexer.py +++ b/sqlgpt_parser/parser/mysql_parser/lexer.py @@ -13,7 +13,7 @@ import re from ply import lex -from sqlgpt_parser.sql_parser.mysql_parser.reserved import ( +from sqlgpt_parser.parser.mysql_parser.reserved import ( reversed, nonreserved, not_keyword_token, diff --git a/sqlgpt_parser/sql_parser/mysql_parser/parser.py b/sqlgpt_parser/parser/mysql_parser/parser.py similarity index 98% rename from sqlgpt_parser/sql_parser/mysql_parser/parser.py rename to sqlgpt_parser/parser/mysql_parser/parser.py index 8a6851e..23f7ddf 100644 --- a/sqlgpt_parser/sql_parser/mysql_parser/parser.py +++ b/sqlgpt_parser/parser/mysql_parser/parser.py @@ -14,7 +14,7 @@ import types, threading -from sqlgpt_parser.sql_parser.tree.window import ( +from sqlgpt_parser.parser.tree.window import ( FrameBound, FrameClause, FrameExpr, @@ -23,9 +23,9 @@ WindowSpec, ) -from sqlgpt_parser.sql_parser.tree.with_stmt import CommonTableExpr, With, WithHasQuery -from sqlgpt_parser.sql_parser.tree.index_type import IndexType -from sqlgpt_parser.sql_parser.tree.expression import ( +from sqlgpt_parser.parser.tree.with_stmt import CommonTableExpr, With, WithHasQuery +from sqlgpt_parser.parser.tree.index_type import IndexType +from sqlgpt_parser.parser.tree.expression import ( AggregateFunc, ArithmeticBinaryExpression, ArithmeticUnaryExpression, @@ -60,9 +60,9 @@ WhenClause, JsonTableColumn, ) -from sqlgpt_parser.sql_parser.tree.grouping import SimpleGroupBy -from sqlgpt_parser.sql_parser.tree.join_criteria import JoinOn, JoinUsing, NaturalJoin -from sqlgpt_parser.sql_parser.tree.literal import ( +from sqlgpt_parser.parser.tree.grouping import SimpleGroupBy +from sqlgpt_parser.parser.tree.join_criteria import JoinOn, JoinUsing, NaturalJoin +from sqlgpt_parser.parser.tree.literal import ( BooleanLiteral, DateLiteral, DoubleLiteral, @@ -73,21 +73,21 @@ DefaultLiteral, ErrorLiteral, ) -from sqlgpt_parser.sql_parser.tree.node import Node -from sqlgpt_parser.sql_parser.tree.qualified_name import QualifiedName -from sqlgpt_parser.sql_parser.tree.query_specification import QuerySpecification -from sqlgpt_parser.sql_parser.tree.relation import AliasedRelation, Join -from sqlgpt_parser.sql_parser.tree.select import Select -from sqlgpt_parser.sql_parser.tree.select_item import Partition, SingleColumn -from sqlgpt_parser.sql_parser.tree.set_operation import Except, Intersect, Union -from sqlgpt_parser.sql_parser.tree.sort_item import ByItem, PartitionByClause, SortItem -from sqlgpt_parser.sql_parser.tree.statement import Delete, Insert, Query, Update -from sqlgpt_parser.sql_parser.tree.table import Table -from sqlgpt_parser.sql_parser.tree.values import Values -from sqlgpt_parser.sql_parser.tree.field_type import UNSPECIFIEDLENGTH, FieldType, SQLType +from sqlgpt_parser.parser.tree.node import Node +from sqlgpt_parser.parser.tree.qualified_name import QualifiedName +from sqlgpt_parser.parser.tree.query_specification import QuerySpecification +from sqlgpt_parser.parser.tree.relation import AliasedRelation, Join +from sqlgpt_parser.parser.tree.select import Select +from sqlgpt_parser.parser.tree.select_item import Partition, SingleColumn +from sqlgpt_parser.parser.tree.set_operation import Except, Intersect, Union +from sqlgpt_parser.parser.tree.sort_item import ByItem, PartitionByClause, SortItem +from sqlgpt_parser.parser.tree.statement import Delete, Insert, Query, Update +from sqlgpt_parser.parser.tree.table import Table +from sqlgpt_parser.parser.tree.values import Values +from sqlgpt_parser.parser.tree.field_type import UNSPECIFIEDLENGTH, FieldType, SQLType from ply import yacc -from sqlgpt_parser.sql_parser.mysql_parser.lexer import tokens, lexer +from sqlgpt_parser.parser.mysql_parser.lexer import tokens, lexer tokens = tokens diff --git a/sqlgpt_parser/sql_parser/mysql_parser/parser_table.py b/sqlgpt_parser/parser/mysql_parser/parser_table.py similarity index 100% rename from sqlgpt_parser/sql_parser/mysql_parser/parser_table.py rename to sqlgpt_parser/parser/mysql_parser/parser_table.py diff --git a/sqlgpt_parser/sql_parser/mysql_parser/reserved.py b/sqlgpt_parser/parser/mysql_parser/reserved.py similarity index 100% rename from sqlgpt_parser/sql_parser/mysql_parser/reserved.py rename to sqlgpt_parser/parser/mysql_parser/reserved.py diff --git a/sqlgpt_parser/sql_parser/odps_parser/__init__.py b/sqlgpt_parser/parser/oceanbase_parser/__init__.py similarity index 100% rename from sqlgpt_parser/sql_parser/odps_parser/__init__.py rename to sqlgpt_parser/parser/oceanbase_parser/__init__.py diff --git a/sqlgpt_parser/sql_parser/oceanbase_parser/lexer.py b/sqlgpt_parser/parser/oceanbase_parser/lexer.py similarity index 97% rename from sqlgpt_parser/sql_parser/oceanbase_parser/lexer.py rename to sqlgpt_parser/parser/oceanbase_parser/lexer.py index 0b9a6d1..0ffe099 100644 --- a/sqlgpt_parser/sql_parser/oceanbase_parser/lexer.py +++ b/sqlgpt_parser/parser/oceanbase_parser/lexer.py @@ -13,7 +13,7 @@ import re from ply import lex -from sqlgpt_parser.sql_parser.oceanbase_parser.reserved import reserved, nonreserved +from sqlgpt_parser.parser.oceanbase_parser.reserved import reserved, nonreserved tokens = ( [ diff --git a/sqlgpt_parser/sql_parser/oceanbase_parser/parser.py b/sqlgpt_parser/parser/oceanbase_parser/parser.py similarity index 98% rename from sqlgpt_parser/sql_parser/oceanbase_parser/parser.py rename to sqlgpt_parser/parser/oceanbase_parser/parser.py index 852d0dc..abe4892 100644 --- a/sqlgpt_parser/sql_parser/oceanbase_parser/parser.py +++ b/sqlgpt_parser/parser/oceanbase_parser/parser.py @@ -13,7 +13,7 @@ from __future__ import print_function import types, threading -from sqlgpt_parser.sql_parser.tree.window import ( +from sqlgpt_parser.parser.tree.window import ( FrameBound, FrameClause, FrameExpr, @@ -23,9 +23,9 @@ ) from ply import yacc -from sqlgpt_parser.sql_parser.tree.index_type import IndexType -from sqlgpt_parser.sql_parser.oceanbase_parser.lexer import tokens, lexer -from sqlgpt_parser.sql_parser.tree.expression import ( +from sqlgpt_parser.parser.tree.index_type import IndexType +from sqlgpt_parser.parser.oceanbase_parser.lexer import tokens, lexer +from sqlgpt_parser.parser.tree.expression import ( AggregateFunc, ArithmeticBinaryExpression, ArithmeticUnaryExpression, @@ -60,9 +60,9 @@ WhenClause, JsonTableColumn, ) -from sqlgpt_parser.sql_parser.tree.grouping import SimpleGroupBy -from sqlgpt_parser.sql_parser.tree.join_criteria import JoinOn, JoinUsing, NaturalJoin -from sqlgpt_parser.sql_parser.tree.literal import ( +from sqlgpt_parser.parser.tree.grouping import SimpleGroupBy +from sqlgpt_parser.parser.tree.join_criteria import JoinOn, JoinUsing, NaturalJoin +from sqlgpt_parser.parser.tree.literal import ( BooleanLiteral, DateLiteral, DoubleLiteral, @@ -73,19 +73,19 @@ DefaultLiteral, ErrorLiteral, ) -from sqlgpt_parser.sql_parser.tree.node import Node -from sqlgpt_parser.sql_parser.tree.qualified_name import QualifiedName -from sqlgpt_parser.sql_parser.tree.query_specification import QuerySpecification -from sqlgpt_parser.sql_parser.tree.relation import AliasedRelation, Join -from sqlgpt_parser.sql_parser.tree.select import Select -from sqlgpt_parser.sql_parser.tree.select_item import Partition, SingleColumn -from sqlgpt_parser.sql_parser.tree.set_operation import Except, Intersect, Union -from sqlgpt_parser.sql_parser.tree.sort_item import ByItem, PartitionByClause, SortItem -from sqlgpt_parser.sql_parser.tree.statement import Delete, Insert, Query, Update -from sqlgpt_parser.sql_parser.tree.table import Table -from sqlgpt_parser.sql_parser.tree.values import Values -from sqlgpt_parser.sql_parser.tree.field_type import UNSPECIFIEDLENGTH, FieldType, SQLType -from sqlgpt_parser.sql_parser.tree.with_stmt import With, CommonTableExpr, WithHasQuery +from sqlgpt_parser.parser.tree.node import Node +from sqlgpt_parser.parser.tree.qualified_name import QualifiedName +from sqlgpt_parser.parser.tree.query_specification import QuerySpecification +from sqlgpt_parser.parser.tree.relation import AliasedRelation, Join +from sqlgpt_parser.parser.tree.select import Select +from sqlgpt_parser.parser.tree.select_item import Partition, SingleColumn +from sqlgpt_parser.parser.tree.set_operation import Except, Intersect, Union +from sqlgpt_parser.parser.tree.sort_item import ByItem, PartitionByClause, SortItem +from sqlgpt_parser.parser.tree.statement import Delete, Insert, Query, Update +from sqlgpt_parser.parser.tree.table import Table +from sqlgpt_parser.parser.tree.values import Values +from sqlgpt_parser.parser.tree.field_type import UNSPECIFIEDLENGTH, FieldType, SQLType +from sqlgpt_parser.parser.tree.with_stmt import With, CommonTableExpr, WithHasQuery tokens = tokens diff --git a/sqlgpt_parser/sql_parser/oceanbase_parser/parser_table.py b/sqlgpt_parser/parser/oceanbase_parser/parser_table.py similarity index 100% rename from sqlgpt_parser/sql_parser/oceanbase_parser/parser_table.py rename to sqlgpt_parser/parser/oceanbase_parser/parser_table.py diff --git a/sqlgpt_parser/sql_parser/oceanbase_parser/reserved.py b/sqlgpt_parser/parser/oceanbase_parser/reserved.py similarity index 100% rename from sqlgpt_parser/sql_parser/oceanbase_parser/reserved.py rename to sqlgpt_parser/parser/oceanbase_parser/reserved.py diff --git a/sqlgpt_parser/sql_parser/__init__.py b/sqlgpt_parser/parser/odps_parser/__init__.py similarity index 87% rename from sqlgpt_parser/sql_parser/__init__.py rename to sqlgpt_parser/parser/odps_parser/__init__.py index d6f93af..a6dd6d3 100644 --- a/sqlgpt_parser/sql_parser/__init__.py +++ b/sqlgpt_parser/parser/odps_parser/__init__.py @@ -9,4 +9,3 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. """ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) \ No newline at end of file diff --git a/sqlgpt_parser/sql_parser/odps_parser/lexer.py b/sqlgpt_parser/parser/odps_parser/lexer.py similarity index 97% rename from sqlgpt_parser/sql_parser/odps_parser/lexer.py rename to sqlgpt_parser/parser/odps_parser/lexer.py index 61c25c3..2a1e6b0 100644 --- a/sqlgpt_parser/sql_parser/odps_parser/lexer.py +++ b/sqlgpt_parser/parser/odps_parser/lexer.py @@ -13,7 +13,7 @@ import re from ply import lex -from sqlgpt_parser.sql_parser.odps_parser.reserved import reserved, nonreserved +from sqlgpt_parser.parser.odps_parser.reserved import reserved, nonreserved tokens = ( [ diff --git a/sqlgpt_parser/sql_parser/odps_parser/parser.py b/sqlgpt_parser/parser/odps_parser/parser.py similarity index 98% rename from sqlgpt_parser/sql_parser/odps_parser/parser.py rename to sqlgpt_parser/parser/odps_parser/parser.py index 6c96e9e..bd7fe89 100644 --- a/sqlgpt_parser/sql_parser/odps_parser/parser.py +++ b/sqlgpt_parser/parser/odps_parser/parser.py @@ -13,7 +13,7 @@ from __future__ import print_function import types, threading -from sqlgpt_parser.sql_parser.tree.window import ( +from sqlgpt_parser.parser.tree.window import ( FrameBound, FrameClause, FrameExpr, @@ -24,9 +24,9 @@ from ply import yacc -from sqlgpt_parser.sql_parser.tree.index_type import IndexType -from sqlgpt_parser.sql_parser.odps_parser.lexer import tokens, lexer -from sqlgpt_parser.sql_parser.tree.expression import ( +from sqlgpt_parser.parser.tree.index_type import IndexType +from sqlgpt_parser.parser.odps_parser.lexer import tokens, lexer +from sqlgpt_parser.parser.tree.expression import ( AggregateFunc, ArithmeticBinaryExpression, ArithmeticUnaryExpression, @@ -61,9 +61,9 @@ WhenClause, JsonTableColumn, ) -from sqlgpt_parser.sql_parser.tree.grouping import SimpleGroupBy -from sqlgpt_parser.sql_parser.tree.join_criteria import JoinOn, JoinUsing, NaturalJoin -from sqlgpt_parser.sql_parser.tree.literal import ( +from sqlgpt_parser.parser.tree.grouping import SimpleGroupBy +from sqlgpt_parser.parser.tree.join_criteria import JoinOn, JoinUsing, NaturalJoin +from sqlgpt_parser.parser.tree.literal import ( BooleanLiteral, DateLiteral, DoubleLiteral, @@ -74,19 +74,19 @@ DefaultLiteral, ErrorLiteral, ) -from sqlgpt_parser.sql_parser.tree.node import Node -from sqlgpt_parser.sql_parser.tree.qualified_name import QualifiedName -from sqlgpt_parser.sql_parser.tree.query_specification import QuerySpecification -from sqlgpt_parser.sql_parser.tree.relation import AliasedRelation, Join -from sqlgpt_parser.sql_parser.tree.select import Select -from sqlgpt_parser.sql_parser.tree.select_item import Partition, SingleColumn -from sqlgpt_parser.sql_parser.tree.set_operation import Except, Intersect, Union -from sqlgpt_parser.sql_parser.tree.sort_item import ByItem, PartitionByClause, SortItem -from sqlgpt_parser.sql_parser.tree.statement import Delete, Insert, Query, Update -from sqlgpt_parser.sql_parser.tree.table import Table -from sqlgpt_parser.sql_parser.tree.values import Values -from sqlgpt_parser.sql_parser.tree.field_type import UNSPECIFIEDLENGTH, FieldType, SQLType -from sqlgpt_parser.sql_parser.tree.with_stmt import With, CommonTableExpr, WithHasQuery +from sqlgpt_parser.parser.tree.node import Node +from sqlgpt_parser.parser.tree.qualified_name import QualifiedName +from sqlgpt_parser.parser.tree.query_specification import QuerySpecification +from sqlgpt_parser.parser.tree.relation import AliasedRelation, Join +from sqlgpt_parser.parser.tree.select import Select +from sqlgpt_parser.parser.tree.select_item import Partition, SingleColumn +from sqlgpt_parser.parser.tree.set_operation import Except, Intersect, Union +from sqlgpt_parser.parser.tree.sort_item import ByItem, PartitionByClause, SortItem +from sqlgpt_parser.parser.tree.statement import Delete, Insert, Query, Update +from sqlgpt_parser.parser.tree.table import Table +from sqlgpt_parser.parser.tree.values import Values +from sqlgpt_parser.parser.tree.field_type import UNSPECIFIEDLENGTH, FieldType, SQLType +from sqlgpt_parser.parser.tree.with_stmt import With, CommonTableExpr, WithHasQuery tokens = tokens diff --git a/sqlgpt_parser/sql_parser/odps_parser/parser_table.py b/sqlgpt_parser/parser/odps_parser/parser_table.py similarity index 100% rename from sqlgpt_parser/sql_parser/odps_parser/parser_table.py rename to sqlgpt_parser/parser/odps_parser/parser_table.py diff --git a/sqlgpt_parser/sql_parser/odps_parser/reserved.py b/sqlgpt_parser/parser/odps_parser/reserved.py similarity index 100% rename from sqlgpt_parser/sql_parser/odps_parser/reserved.py rename to sqlgpt_parser/parser/odps_parser/reserved.py diff --git a/sqlgpt_parser/sql_parser/parser_utils.py b/sqlgpt_parser/parser/parser_utils.py similarity index 97% rename from sqlgpt_parser/sql_parser/parser_utils.py rename to sqlgpt_parser/parser/parser_utils.py index d17c2aa..80d6695 100644 --- a/sqlgpt_parser/sql_parser/parser_utils.py +++ b/sqlgpt_parser/parser/parser_utils.py @@ -10,11 +10,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. """ -from sqlgpt_parser.sql_parser.tree.grouping import GroupingSets, SimpleGroupBy -from sqlgpt_parser.sql_parser.tree.literal import StringLiteral -from sqlgpt_parser.sql_parser.tree.select_item import SingleColumn -from sqlgpt_parser.sql_parser.tree.visitor import DefaultTraversalVisitor -from sqlgpt_parser.sql_parser.tree.expression import ( +from sqlgpt_parser.parser.tree.grouping import GroupingSets, SimpleGroupBy +from sqlgpt_parser.parser.tree.literal import StringLiteral +from sqlgpt_parser.parser.tree.select_item import SingleColumn +from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor +from sqlgpt_parser.parser.tree.expression import ( FunctionCall, InListExpression, QualifiedNameReference, diff --git a/sqlgpt_parser/sql_parser/tree/__init__.py b/sqlgpt_parser/parser/tree/__init__.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/__init__.py rename to sqlgpt_parser/parser/tree/__init__.py diff --git a/sqlgpt_parser/sql_parser/tree/approximate.py b/sqlgpt_parser/parser/tree/approximate.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/approximate.py rename to sqlgpt_parser/parser/tree/approximate.py diff --git a/sqlgpt_parser/sql_parser/tree/call_argument.py b/sqlgpt_parser/parser/tree/call_argument.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/call_argument.py rename to sqlgpt_parser/parser/tree/call_argument.py diff --git a/sqlgpt_parser/sql_parser/tree/explain.py b/sqlgpt_parser/parser/tree/explain.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/explain.py rename to sqlgpt_parser/parser/tree/explain.py diff --git a/sqlgpt_parser/sql_parser/tree/expression.py b/sqlgpt_parser/parser/tree/expression.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/expression.py rename to sqlgpt_parser/parser/tree/expression.py diff --git a/sqlgpt_parser/sql_parser/tree/field_type.py b/sqlgpt_parser/parser/tree/field_type.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/field_type.py rename to sqlgpt_parser/parser/tree/field_type.py diff --git a/sqlgpt_parser/sql_parser/tree/grouping.py b/sqlgpt_parser/parser/tree/grouping.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/grouping.py rename to sqlgpt_parser/parser/tree/grouping.py diff --git a/sqlgpt_parser/sql_parser/tree/index_type.py b/sqlgpt_parser/parser/tree/index_type.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/index_type.py rename to sqlgpt_parser/parser/tree/index_type.py diff --git a/sqlgpt_parser/sql_parser/tree/join_criteria.py b/sqlgpt_parser/parser/tree/join_criteria.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/join_criteria.py rename to sqlgpt_parser/parser/tree/join_criteria.py diff --git a/sqlgpt_parser/sql_parser/tree/literal.py b/sqlgpt_parser/parser/tree/literal.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/literal.py rename to sqlgpt_parser/parser/tree/literal.py diff --git a/sqlgpt_parser/sql_parser/tree/node.py b/sqlgpt_parser/parser/tree/node.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/node.py rename to sqlgpt_parser/parser/tree/node.py diff --git a/sqlgpt_parser/sql_parser/tree/qualified_name.py b/sqlgpt_parser/parser/tree/qualified_name.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/qualified_name.py rename to sqlgpt_parser/parser/tree/qualified_name.py diff --git a/sqlgpt_parser/sql_parser/tree/query_specification.py b/sqlgpt_parser/parser/tree/query_specification.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/query_specification.py rename to sqlgpt_parser/parser/tree/query_specification.py diff --git a/sqlgpt_parser/sql_parser/tree/relation.py b/sqlgpt_parser/parser/tree/relation.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/relation.py rename to sqlgpt_parser/parser/tree/relation.py diff --git a/sqlgpt_parser/sql_parser/tree/rewrite.py b/sqlgpt_parser/parser/tree/rewrite.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/rewrite.py rename to sqlgpt_parser/parser/tree/rewrite.py diff --git a/sqlgpt_parser/sql_parser/tree/select.py b/sqlgpt_parser/parser/tree/select.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/select.py rename to sqlgpt_parser/parser/tree/select.py diff --git a/sqlgpt_parser/sql_parser/tree/select_item.py b/sqlgpt_parser/parser/tree/select_item.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/select_item.py rename to sqlgpt_parser/parser/tree/select_item.py diff --git a/sqlgpt_parser/sql_parser/tree/set_operation.py b/sqlgpt_parser/parser/tree/set_operation.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/set_operation.py rename to sqlgpt_parser/parser/tree/set_operation.py diff --git a/sqlgpt_parser/sql_parser/tree/sort_item.py b/sqlgpt_parser/parser/tree/sort_item.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/sort_item.py rename to sqlgpt_parser/parser/tree/sort_item.py diff --git a/sqlgpt_parser/sql_parser/tree/statement.py b/sqlgpt_parser/parser/tree/statement.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/statement.py rename to sqlgpt_parser/parser/tree/statement.py diff --git a/sqlgpt_parser/sql_parser/tree/table.py b/sqlgpt_parser/parser/tree/table.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/table.py rename to sqlgpt_parser/parser/tree/table.py diff --git a/sqlgpt_parser/sql_parser/tree/table_element.py b/sqlgpt_parser/parser/tree/table_element.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/table_element.py rename to sqlgpt_parser/parser/tree/table_element.py diff --git a/sqlgpt_parser/sql_parser/tree/transaction.py b/sqlgpt_parser/parser/tree/transaction.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/transaction.py rename to sqlgpt_parser/parser/tree/transaction.py diff --git a/sqlgpt_parser/sql_parser/tree/values.py b/sqlgpt_parser/parser/tree/values.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/values.py rename to sqlgpt_parser/parser/tree/values.py diff --git a/sqlgpt_parser/sql_parser/tree/visitor.py b/sqlgpt_parser/parser/tree/visitor.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/visitor.py rename to sqlgpt_parser/parser/tree/visitor.py diff --git a/sqlgpt_parser/sql_parser/tree/window.py b/sqlgpt_parser/parser/tree/window.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/window.py rename to sqlgpt_parser/parser/tree/window.py diff --git a/sqlgpt_parser/sql_parser/tree/with_stmt.py b/sqlgpt_parser/parser/tree/with_stmt.py similarity index 100% rename from sqlgpt_parser/sql_parser/tree/with_stmt.py rename to sqlgpt_parser/parser/tree/with_stmt.py diff --git a/test/format/test_sql_formatter.py b/test/format/test_sql_formatter.py index 3a9a0b3..075e01b 100644 --- a/test/format/test_sql_formatter.py +++ b/test/format/test_sql_formatter.py @@ -1,7 +1,7 @@ import unittest from sqlgpt_parser.format.formatter import format_sql -from sqlgpt_parser.sql_parser.mysql_parser import parser +from sqlgpt_parser.parser.mysql_parser import parser class MyTestCase(unittest.TestCase): diff --git a/test/parser/test_parser_ddl.py b/test/parser/test_parser_ddl.py index 9f3cb3f..4277c2e 100644 --- a/test/parser/test_parser_ddl.py +++ b/test/parser/test_parser_ddl.py @@ -15,7 +15,7 @@ import unittest -from sqlgpt_parser.sql_parser.mysql_parser import parser +from sqlgpt_parser.parser.mysql_parser import parser class MyTestCase(unittest.TestCase): diff --git a/test/parser/test_parser_dml.py b/test/parser/test_parser_dml.py index fa23c93..75d6287 100644 --- a/test/parser/test_parser_dml.py +++ b/test/parser/test_parser_dml.py @@ -14,12 +14,12 @@ import unittest -from sqlgpt_parser.sql_parser.tree.with_stmt import WithHasQuery +from sqlgpt_parser.parser.tree.with_stmt import WithHasQuery -from sqlgpt_parser.sql_parser.mysql_parser import parser as mysql_parser -from sqlgpt_parser.sql_parser.oceanbase_parser import parser as oceanbase_parser -from sqlgpt_parser.sql_parser.tree.expression import ComparisonExpression -from sqlgpt_parser.sql_parser.tree.statement import Statement +from sqlgpt_parser.parser.mysql_parser import parser as mysql_parser +from sqlgpt_parser.parser.oceanbase_parser import parser as oceanbase_parser +from sqlgpt_parser.parser.tree.expression import ComparisonExpression +from sqlgpt_parser.parser.tree.statement import Statement import warnings diff --git a/test/parser/test_parser_dql.py b/test/parser/test_parser_dql.py index 4305433..d603fa1 100644 --- a/test/parser/test_parser_dql.py +++ b/test/parser/test_parser_dql.py @@ -14,13 +14,13 @@ import unittest -from sqlgpt_parser.sql_parser.mysql_parser import parser as mysql_parser -from sqlgpt_parser.sql_parser.oceanbase_parser import parser as oceanbase_parser -from sqlgpt_parser.sql_parser.odps_parser import parser as odps_parser -from sqlgpt_parser.sql_parser.tree.expression import LikePredicate, ExistsPredicate -from sqlgpt_parser.sql_parser.tree.relation import Join -from sqlgpt_parser.sql_parser.tree.set_operation import Union -from sqlgpt_parser.sql_parser.tree.statement import Statement +from sqlgpt_parser.parser.mysql_parser import parser as mysql_parser +from sqlgpt_parser.parser.oceanbase_parser import parser as oceanbase_parser +from sqlgpt_parser.parser.odps_parser import parser as odps_parser +from sqlgpt_parser.parser.tree.expression import LikePredicate, ExistsPredicate +from sqlgpt_parser.parser.tree.relation import Join +from sqlgpt_parser.parser.tree.set_operation import Union +from sqlgpt_parser.parser.tree.statement import Statement class MyTestCase(unittest.TestCase):