You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/01/05 08:19:58 UTC

[GitHub] [dolphinscheduler] devosend commented on a change in pull request #7801: [python] Enhance task datax example

devosend commented on a change in pull request #7801:
URL: https://github.com/apache/dolphinscheduler/pull/7801#discussion_r778621989



##########
File path: dolphinscheduler-python/pydolphinscheduler/examples/task_datax_example.py
##########
@@ -29,14 +29,67 @@
 from pydolphinscheduler.tasks.datax import CustomDataX, DataX
 
 # datax json template
-JSON_TEMPLATE = ""
+JSON_TEMPLATE = {
+    "job": {
+        "content": [
+            {
+                "reader": {
+                    "name": "mysqlreader",
+                    "parameter": {
+                        "username": "usr",
+                        "password": "pwd",
+                        "column": [
+                            "id",
+                            "name",
+                            "code",
+                            "description"
+                        ],
+                        "splitPk": "id",
+                        "connection": [
+                            {
+                                "table": [
+                                    "source_table"
+                                ],
+                                "jdbcUrl": [
+                                    "jdbc:mysql://127.0.0.1:3306/source_db"
+                                ]
+                            }
+                        ]
+                    }
+                },
+                "writer": {
+                    "name": "mysqlwriter",
+                    "parameter": {
+                        "writeMode": "insert",
+                        "username": "usr",
+                        "password": "pwd",
+                        "column": [
+                            "id",
+                            "name"
+                        ],
+                        "connection": [
+                            {
+                                "jdbcUrl": "jdbc:mysql://127.0.0.1:3306/target_db",
+                                "table": [
+                                    "target_table"
+                                ]
+                            }
+                        ]
+                    }
+                }
+            }
+        ]

Review comment:
       I failed to run this task. Error message:
   ![image](https://user-images.githubusercontent.com/8847400/148183682-e2b7eecb-e81e-46d6-82f4-55a247e7ab70.png)
   So I think you should add `setting` key after `content` key.
   ```
    "setting":{
       "errorLimit":{
       	   "percentage":0,
       		"record":0
       	},
       	"speed":{
       		"channel":1,
       		"record":1000
       	}
    }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org