You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by zh...@apache.org on 2022/06/16 01:39:59 UTC

[dolphinscheduler] branch dev updated: [fix][python] Correct variable type of SQL type (#10464)

This is an automated email from the ASF dual-hosted git repository.

zhongjiajie pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new f512e3c31f [fix][python] Correct variable type of SQL type (#10464)
f512e3c31f is described below

commit f512e3c31f4850c7272e868b291193a58c661d57
Author: 陈家名 <13...@163.com>
AuthorDate: Thu Jun 16 09:39:53 2022 +0800

    [fix][python] Correct variable type of SQL type (#10464)
---
 .../pydolphinscheduler/src/pydolphinscheduler/tasks/sql.py        | 8 ++++----
 .../pydolphinscheduler/tests/tasks/test_sql.py                    | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/tasks/sql.py b/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/tasks/sql.py
index c15170c448..a1259824f1 100644
--- a/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/tasks/sql.py
+++ b/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/tasks/sql.py
@@ -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
diff --git a/dolphinscheduler-python/pydolphinscheduler/tests/tasks/test_sql.py b/dolphinscheduler-python/pydolphinscheduler/tests/tasks/test_sql.py
index 74ac0f67ea..ee0acc442e 100644
--- a/dolphinscheduler-python/pydolphinscheduler/tests/tasks/test_sql.py
+++ b/dolphinscheduler-python/pydolphinscheduler/tests/tasks/test_sql.py
@@ -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": [],