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

This commit is contained in:
陈家名 2022-06-16 09:39:53 +08:00 committed by GitHub
parent 720a10a21e
commit f512e3c31f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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": [],