在job配置文件中,Table字段增加若干参数,详情参考4.3 作业配置,使用方法如下
job.json中ReplicateDoDb配置:
"ReplicateDoDb":[
{
"TableSchema":"demo",
"TableSchemaRename":"demoRename"
}
],
src : demo
dest: demoRename
job.json中ReplicateDoDb配置:
"ReplicateDoDb":[
{
"TableSchemaRegex":"(\\w*)src(\\w*)",
"TableSchemaRename":"rename${1}",
}
],
src : test1src,test2src,test3src,cust
dest: renametest1, renametest2, renametest3
job.json中ReplicateDoDb配置:
"ReplicateDoDb":[
{
"TableSchema":"demo",
"Tables":[
{
"TableName":"testDemo",
"TableRename":"renameDemo"
}
]
}
],
src : demo.testDemo
dest: demo.renameDemo
job.json中ReplicateDoDb配置:
"ReplicateDoDb":[
{
"TableSchema":"demo",
"Tables":[
{
"TableRegex":"(\\w*)Shard(\\w*)",
"TableRename":"${1}Rename"
}
]
}
],
src : demo.test1Shard,demo.test2Shard,demo.customer,demo.test3Shard
dest: demo.test1Rename,demo.test2Rename,demo.test3Rename
src table
create table demo.colmap (id int primary key, val1 int, val2 int)
dst table
create table demo.colmap (val2 int, id int primary key)
使用 ColumnMapFrom
调整列顺序并忽略 val1
列。注意预先创建好表。
"ReplicateDoDb": [{
"TableSchema":"demo",
"Tables":[{
"TableName": "colmap",
"ColumnMapFrom": ["val1", "id"]
}]
}],
"SkipCreateDbTable": true,
"DropTableIfExists": false,
暂不支持列重命名和正则匹配。