{
"job": {
"setting": {
"speed": {
"channel": 3
},
"errorLimit": {
"record": 0,
"percentage": 0.02
}
},
"content": [{
"reader": {
"name": "mysqlreader",
"parameter": {
"username": "root",
"password": "APIB9hRP",
"column": [
"id",
"name",
"age",
"address",
"salary"
],
"splitPk": "id",
"connection": [{
"table": [
"company"
],
"jdbcUrl": [
"jdbc:mysql://localhost:3306/datax?serverTimezone=UTC"
]
}]
}
},
"writer": {
"name": "mysqlwriter",
"parameter": {
"writeMode": "insert",
"username": "root",
"password": "APIB9hRP",
"column": [
"id",
"name",
"age",
"address",
"salary"
],
"session": [
"set session sql_mode='ANSI'"
],
"preSql": [
"delete from company"
],
"connection": [{
"table": [
"company"
],
"jdbcUrl": "jdbc:mysql://localhost:3306/datax2?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8"
}]
}
}
}]
}
}
{
"job": {
"setting": {
"speed": {
"channel": 3
},
"errorLimit": {
"record": 0,
"percentage": 0.02
}
},
"content": [{
"reader": {
"name": "mysqlreader",
"parameter": {
"username": "root",
"password": "APIB9hRP",
"column": [
"id",
"name",
"age",
"address",
"salary"
],
"splitPk": "id",
"where":"id>4",
"connection": [{
"table": [
"company"
],
"jdbcUrl": [
"jdbc:mysql://localhost:3306/datax?serverTimezone=UTC"
]
}]
}
},
"writer": {
"name": "mysqlwriter",
"parameter": {
"writeMode": "insert",
"username": "root",
"password": "APIB9hRP",
"column": [
"id",
"name",
"age",
"address",
"salary"
],
"session": [
"set session sql_mode='ANSI'"
],
"connection": [{
"table": [
"company"
],
"jdbcUrl": "jdbc:mysql://localhost:3306/datax2?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8"
}]
}
}
}]
}
}
"where":"TO_DAYS( NOW( ) ) - TO_DAYS(createtime) <= 1",
datax不能同时既配置table又配置querySql
{
"job": {
"setting": {
"speed": {
"channel": 3
},
"errorLimit": {
"record": 0,
"percentage": 0.02
}
},
"content": [{
"reader": {
"name": "mysqlreader",
"parameter": {
"username": "root",
"password": "APIB9hRP",
"column": [
"id",
"dept",
"createtime"
],
"splitPk": "id",
"connection": [{
"querySql": ["select * from DEPARTMENT where id=1"],
"jdbcUrl": [
"jdbc:mysql://localhost:3306/datax?serverTimezone=UTC"
]
}]
}
},
"writer": {
"name": "mysqlwriter",
"parameter": {
"writeMode": "insert",
"username": "root",
"password": "APIB9hRP",
"column": [
"id",
"dept",
"createtime"
],
"session": [
"set session sql_mode='ANSI'"
],
"connection": [{
"table": [
"DEPARTMENT"
],
"jdbcUrl": "jdbc:mysql://localhost:3306/datax2?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8"
}]
}
}
}]
}
}