Sqoop将数据从Mysql导入Hive中

hive导入参数
  --hive-home 重写$HIVE_HOME
  --hive-import 插入数据到hive当中,使用hive的默认分隔符
  --hive-overwrite 重写插入
  --create-hive-table 建表,如果表已经存在,该操作会报错!
  --hive-table [table] 设置到hive当中的表名
  --hive-drop-import-delims 导入到hive时删除 \n, \r, and \01
  --hive-delims-replacement 导入到hive时用自定义的字符替换掉 \n, \r, and \01
  --hive-partition-key hive分区的key
  --hive-partition-value hive分区的值
  --map-column-hive 类型匹配,sql类型对应到hive类型


sqoop import \
--connect "jdbc:mysql://localhost:3306/managdb?useUnicode=true&characterEncoding=utf-8" --username XX --password xxxx\
--query "select p FROM TB where \$CONDITIONS;" -m 1 \
--null-string 'null' --null-non-string 'null' \
--fields-terminated-by ',' --lines-terminated-by '\n' \
--hive-drop-import-delims \
--target-dir /usr/local/data --as-textfile \
--delete-target-dir;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值