Skip to content

Latest commit

 

History

History
117 lines (96 loc) · 2.45 KB

3.8_dtle_mapping.md

File metadata and controls

117 lines (96 loc) · 2.45 KB

dtle mapping

在job配置文件中,Table字段增加若干参数,详情参考4.3 作业配置,使用方法如下

schema mapping

单库mapping

job.json中ReplicateDoDb配置:

 "ReplicateDoDb":[
                    {
                        "TableSchema":"demo",
                        "TableSchemaRename":"demoRename"
                    }
                ],

单库mapping结果

src : demo
dest: demoRename

多库mapping

job.json中ReplicateDoDb配置:

 "ReplicateDoDb":[
                    { 
                        "TableSchemaRegex":"(\\w*)src(\\w*)",
                        "TableSchemaRename":"rename${1}",
                    }
                ],

多库mapping结果

src : test1src,test2src,test3src,cust
dest: renametest1, renametest2, renametest3

table mapping

单表mapping

job.json中ReplicateDoDb配置:

 "ReplicateDoDb":[
                    {
                        "TableSchema":"demo",
                        "Tables":[
                            {
                                "TableName":"testDemo",
                                "TableRename":"renameDemo"
                            }
                        ]
                    }
                ],

单表mapping结果

src : demo.testDemo
dest: demo.renameDemo

多表mapping

job.json中ReplicateDoDb配置:

 "ReplicateDoDb":[
                    {
                        "TableSchema":"demo",
                        "Tables":[
                            {
                                "TableRegex":"(\\w*)Shard(\\w*)",
                                "TableRename":"${1}Rename"
                            }
                        ]
                    }
                ],

多表mapping结果

src : demo.test1Shard,demo.test2Shard,demo.customer,demo.test3Shard
dest: demo.test1Rename,demo.test2Rename,demo.test3Rename

列mapping

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,

暂不支持列重命名和正则匹配。