[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"
相关推荐
小此方4 小时前
Re:Mysql数据库基础篇(十二):什么是事务、事务解决了什么问题、事务的四大属性、事务的操作方式
数据库·mysql
csdn_aspnet5 小时前
macOS 10 、Docker 玩轉 MySQL
运维·mysql·macos·docker·容器·mac
王中阳Go6 小时前
100 件货卖出 116 件,库存停在 -16
后端·mysql·go
吾AI科技6 小时前
基于Tez引擎的 Hive SQL 性能优化 —— 为什么脚本运行越来越慢
大数据·hive·性能优化·tez
nice_lcj5208 小时前
MySQL 存储引擎入门:InnoDB 和 MyISAM 到底怎么选
java·数据库·mysql·面试·innodb·存储引擎·myisam
xixingzhe29 小时前
mysql全量、增量备份
数据库·mysql
隔窗听雨眠21 小时前
MySQL三表JOIN执行内核与优化器决策机制
数据库·mysql·sql优化
Decay__1 天前
SQLServer 索引与 SQL 优化 —— 聚集索引、非聚集索引、覆盖索引、碎片维护与执行计划
运维·数据库·sql·mysql·架构
星恒随风1 天前
MySQL 从零入门(六):复合查询详解——多表查询、自连接、子查询与 UNION
linux·服务器·数据库·mysql
隔窗听雨眠1 天前
MySQL进程卡死的定位思路与恢复实践
mysql·故障排查·数据库运维