DataX之type-value配置Hive-to-MySQL

18 篇文章 2 订阅
9 篇文章 0 订阅

1、脚本

{
    "job": {
        "setting": {
            "speed": {
                "channel": 3
            }
        },
        "content": [
            {
                "reader": {
                    "name": "hdfsreader",
                    "parameter": {
                        "path": "/user/hive/warehouse/ods.db/ods_basic_info/*",
                        "defaultFS": "hdfs://node03:9000",
                        "column": [
                               {
                                "index": 0,
                                "type": "string"
                               },
                               {
                                "index": 1,
                                "type": "string"
                               },
                               {
                                "type": "string",
                                "value": ""
                               },
                               {
                                "index": 3,
                                "type": "string",
                               },
                               {
                                "type": "string",
                                "value": "自定义赋值",
                               },
                               {
                                "index": 5,
                                "type": "string",
                               },
                               {
                                "index": 6,
                                "type": "string",
                               },
                               {
                                "index": 7,
                                "type": "string",
                               }
                        ],
                        "fileType": "text",
                        "encoding": "UTF-8",
                        "fieldDelimiter": "|"
                    }

                },
                "writer": {
                    "name": "mysqlwriter",
                    "parameter": {
                        "writeMode": "insert",
                        "username": "root",
                        "password": "123456",
                        "column": [
							"tar_comany_id",
							"tar_corporation_code",
							"tar_company",
							"tar_corporation_person",
							"tar_province_code",
							"tar_province",
							"tar_city_code",
							"tar_city"
                        ],
                        "session": [
                        	"set session sql_mode='ANSI'"
                        ],
                        "preSql": [
                            "truncate table basic_info"
                        ],
                        "connection": [
                            {
                                "jdbcUrl": "jdbc:mysql://node03:30005/cp_test?useUnicode=true&characterEncoding=gbk",
                                "table": [
                                    "basic_info"
                                ]
                            }
                        ]
                    }
                }
            }
        ]
    }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值