[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"
相关推荐
木下~learning1 分钟前
MySQL 从入门到精通:安装、终端操作、远程连接与 C 语言 API 全教程
c语言·数据库·mysql
阿维的博客日记15 分钟前
MySQL中type字段解析
数据库·mysql
Trouvaille ~19 分钟前
【MySQL篇】表的操作:数据的容器
linux·数据库·mysql·oracle·xshell·ddl·表的操作
黑牛儿20 分钟前
从0开始实现Mysql主从配置实战
服务器·数据库·后端·mysql
麦聪聊数据29 分钟前
数据库安全与运维管控(一):MySQL、PG与Oracle原生审计机制对比
运维·数据库·mysql·oracle
海边的Kurisu1 小时前
MySQL | 从SQL到数据的完整路径
数据库·mysql·架构
做个文艺程序员2 小时前
MySQL 主从延迟根因诊断法
数据库·mysql
小红的布丁2 小时前
MySQL 和 Redis 数据一致性,以及 Redis 与 ZooKeeper 分布式锁对比
redis·分布式·mysql
恋喵大鲤鱼2 小时前
MySQL 某个表字段实现分布式锁
mysql·分布式锁
lifewange2 小时前
GaussDB /openGauss 与 MySQL、Oracle、PostgreSQL 核心对比表
mysql·oracle·gaussdb