[sqoop]hive导入mysql,其中mysql的列存在默认值列

一、思路

直接在hive表中去掉有默认值的了列,在sqoop导入时,指定非默认值列即可,

二、具体

mysql的表

hive的表

sql 复制代码
create table dwd.dwd_hk_rcp_literature(
    id string,
    literature_no string,
    authors string,
    article_title string,
    source_title string,
    publication_date string,
    publication_year string,
    volume string,
    issue string,
    price string,
    created_at string,--插入时间
--     updated_at string,--这个字段不管
--     delete_status string,--有默认值
    abstract string
)
row format delimited
fields terminated by "\001"
;

sqoop导入

sql 复制代码
sqoop export \
--connect jdbc:mysql://ip:端口号/yly_ms_dev \
--username 用户名 \
--password 密码 \
--table hk_rcp_literature \
--columns "id,literature_no,author,article_title,source_title,publication_date,publication_year,volume,issue,price,created_at,abstracts" \
--export-dir /user/hive/warehouse/dwd.db/dwd_hk_rcp_literature \
--input-fields-terminated-by "\001"
相关推荐
缘来如此҉16 分钟前
Mysql数据库——增删改查CRUD
数据库·mysql·oracle
modelmd1 小时前
mysql not in 查询引发的bug问题记录
sql·mysql
计艺回忆路2 小时前
Hive自定义函数(UDF)开发和应用流程
hive·自定义函数·udf
会编程的林俊杰2 小时前
MySQL中的锁有哪些
数据库·mysql
midsummer_woo14 小时前
基于springboot+vue+mysql工程教育认证的计算机课程管理平台(源码+论文)
vue.js·spring boot·mysql
神仙别闹1 天前
基于 .Net Core+MySQL开发(WinForm)翻译平台
数据库·mysql·.netcore
城里有一颗星星1 天前
7.事务操作
数据库·mysql·goland
云边散步1 天前
🥢 第2篇:SELECT就是点菜,FROM就是菜单 —— 写你人生第一句SQL!
sql·mysql