未验证 提交 f512e3c3 编写于 作者: 陈家名 提交者: GitHub

[fix][python] Correct variable type of SQL type (#10464)

上级 720a10a2
......@@ -31,8 +31,8 @@ log = logging.getLogger(__file__)
class SqlType:
"""SQL type, for now it just contain `SELECT` and `NO_SELECT`."""
SELECT = 0
NOT_SELECT = 1
SELECT = "0"
NOT_SELECT = "1"
class Sql(Task):
......@@ -64,7 +64,7 @@ class Sql(Task):
name: str,
datasource_name: str,
sql: str,
sql_type: Optional[int] = None,
sql_type: Optional[str] = None,
pre_statements: Optional[str] = None,
post_statements: Optional[str] = None,
display_rows: Optional[int] = 10,
......@@ -80,7 +80,7 @@ class Sql(Task):
self.display_rows = display_rows
@property
def sql_type(self) -> int:
def sql_type(self) -> str:
"""Judgement sql type, it will return the SQL type for type `SELECT` or `NOT_SELECT`.
If `param_sql_type` dot not specific, will use regexp to check
......
......@@ -89,7 +89,7 @@ def test_get_sql_type(
"sql": "select 1",
"type": "MYSQL",
"datasource": 1,
"sqlType": SqlType.SELECT,
"sqlType": "0",
"preStatements": [],
"postStatements": [],
"displayRows": 10,
......@@ -138,7 +138,7 @@ def test_sql_get_define(mock_datasource):
"type": "MYSQL",
"datasource": 1,
"sql": command,
"sqlType": SqlType.SELECT,
"sqlType": "0",
"displayRows": 10,
"preStatements": [],
"postStatements": [],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册