mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-11-30 11:17:54 +08:00
[fix][python] Correct variable type of SQL type (#10464)
This commit is contained in:
parent
720a10a21e
commit
f512e3c31f
@ -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": [],
|
||||
|
Loading…
Reference in New Issue
Block a user