dataX_from_mysql_to_hive orc分区表

8 篇文章 0 订阅
3 篇文章 0 订阅

1. hive建表:

CREATE TABLE ods.ods_mysql_to_hive_orc_partiton(

  `id` int ,

  `name` string COMMENT 'name'

)  COMMENT '测试表_测试datax_导入_orc分区表' PARTITIONED BY (`dayid` string comment '分区字段')

ROW FORMAT DELIMITED FIELDS TERMINATED BY '^'  STORED AS orc;

2.导入前,增加分区

alter table ods.ods_mysql_to_hive_orc_partiton drop partition (dayid=${dayid_1d_ago_global})

alter table ods.ods_mysql_to_hive_orc_partiton add partition (dayid=${dayid_1d_ago_global})

3.datax导入语句

{

  "job": {

    "setting": {

      "speed": {

        "channel": "1"

      },

      "errorLimit": {

        "record": 0,

        "percentage": 1

      }

    },

    "content": [

      {

        "reader": {

          "name": "mysqlreader",

          "parameter": {

            "username": "username",

            "password": "password",

            "splitPk": "",

            "column": [

              "`id`","`name`"

            ],

            "where": "",

            "connection": [

              {

                "jdbcUrl": ["jdbc:mysql://192.168.2.149:3306/database_name?serverTimezone=Asia/Shanghai"],

                "table": ["`bable_name`"]

              }

            ]

          }

        },

        "writer": {

          "name": "hdfswriter",

          "parameter": {

            "defaultFS": "hdfs://namenode.hive.com.cn:3366",

            "fileType": "orc",

            "path": "/warehouse/tablespace/managed/hive/ods.db/ods_mysql_to_hive_orc_partiton/dayid=$dayid/",

            "fileName": "000000_0",

            "column": [

              {"name": "id","type": "int"},{"name": "name","type": "string"}

            ],

            "writeMode": "append",

            "fieldDelimiter": "^",

            "compress": "snappy"

          }

        }

      }

    ]

  }

}

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值