[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"
相关推荐
蒂法就是我1 天前
mysql主键索引和其他索引区别在哪里?
数据库·mysql
PD我是你的真爱粉1 天前
MySQL8新特性
数据库·mysql
知识即是力量ol1 天前
口语八股——MySQL 核心原理系列(终篇):SQL优化篇、日志与主从复制篇、高级特性篇、面试回答技巧总结
sql·mysql·面试·核心原理
仍然.1 天前
MYSQL---事务
数据库·mysql
ruxshui1 天前
MySQL备份核心指南
数据库·mysql
霖霖总总1 天前
[小技巧73]MySQL UUID 全面解析:UUID 的原理、结构与最佳实践
数据库·mysql
zhangyueping83851 天前
4、MYSQL-DQL-基本查询
数据库·mysql
luoluoal2 天前
基于python的医疗知识图谱问答系统(源码+文档)
python·mysql·django·毕业设计·源码
I'm Jie2 天前
【已解决】SqlAlchemy 插入 MySQL JSON 字段时 None 变为 ‘null‘ 字符串,WHERE IS NULL 失效
数据库·python·mysql·json·fastapi·sqlalchemy