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 2021/10/06 23:20:36 UTC

[GitHub] [dolphinscheduler] github-actions[bot] commented on issue #6451: [Bug] [DataX] Read data from mysql and write to SqlServer 2012 database (DS version: 1.3.6)

github-actions[bot] commented on issue #6451:
URL: https://github.com/apache/dolphinscheduler/issues/6451#issuecomment-937318662


   ### Search before asking
   
   -[X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### What happened
   
   In the DS 1.3.6 version, I use the datax plug-in, the data source is mysql, the target source is sqlserver, and the "non-custom template" method is used, that is, write SQL statements in mysql and fill in the table name directly in the target sqlserver. , And then run this node. As a result, an error was reported during operation, and the error content is as follows:
   "Description: [Failed to obtain table field related information.].-Failed to obtain the meta information of the field of table: test_tmp_20211001. Please contact DBA to check the database and table information.-com.microsoft.sqlserver.jdbc.SQLServerException: "`" There is a grammatical error nearby."
   
   After DataX is running under DS, it can be seen in the log that it is like this when obtaining the sqlserver metadata field:
   "writer":{
   "name":"sqlserverwriter",
   "parameter":{
   "column":[
   "`suppid`"
   ]
   
   The sqlserver table field is caused by `this number, which results in an error when querying metadata in sqlserver. The DS source code is as follows:
   switch (dbType) {
               case MYSQL:
                   return String.format("`%s`", column);
               case POSTGRESQL:
                   return String.format("\"%s\"", column);
               case ORACLE:
                   return String.format("\"%s\"", column);
               case SQLSERVER:
                   return String.format("`%s`", column); --------- This is it! ! ! !
               default:
                   return column;
           }
       }
   
   The github location where the source code is located: dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxUtils.java
   
   
   
   
   ### What you expected to happen
   
   As mentioned above, the datax plug-in is also used in DS and the "custom template" method is used to paste the configuration information and table fields, and the fields are without `quotation marks, the mysql data is successfully written to the sqlserver, and the writing is successful.
   
   ### How to reproduce
   
   Use "custom template" instead, but using this, the graphical interface loses its meaning, and it is very inconvenient to paste configuration information. You have to paste account passwords and links every time.
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   -[X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   -[X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)


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