datax先删除数据再同步
解决方法:
在json文件中的writer中添加属性preSql即可,如果全量同步就用truncate,增量同步就用delete的sql即可。
"writer": {
"name": "mysqlwriter",
"parameter": {
"writeMode": "replace",
"username": "root",
"password": "",
"column": ["universalcode"],
"session": [
"set session sql_mode='ANSI'"
],
"preSql":["truncate table 表名"],
"connection": [
{
"jdbcUrl": "jdbc:mysql://xxx.xx.xx.xx:4000/clouds?yearIsDateType=false&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true",
"table": [
"表名"
]
}
]
}
}