一、思路
直接在hive表中去掉有默认值的了列,在sqoop导入时,指定非默认值列即可,
二、具体
mysql的表
hive的表
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导入
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"