[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"
相关推荐
FYKJ_201034 分钟前
springboot家政服务平台66766-计算机课程设计、毕业设计
java·vue.js·spring boot·后端·mysql·spark·课程设计
ao-weilai38 分钟前
MySQL数据库:数据类型
android·数据库·mysql
Mortalbreeze1 小时前
MySQL 基础篇(四):表的约束
linux·服务器·数据库·mysql
傲世仙尊1 小时前
MySQL上手-库与表的操作编码校验集与备份还原
数据库·mysql
卷毛迷你猪1 小时前
快速实验篇(B10)品类共现与关联规则实战
大数据·hive·hadoop
卷毛迷你猪1 小时前
快速实验篇(B09)城市维度分析,均匀随机字段的识别与证明
大数据·hive·hadoop
小马同学-16 小时前
mysql数据库原理
数据库·mysql
布莱克60519 小时前
MySQL 增删改查(CRUD)语法详解
数据库·mysql·增删改查
rm -rf * && haha.sh21 小时前
【Linux】Rocky 9.8 操作系统磁盘分区与MySQL数据目录迁移
linux·运维·mysql
ao-weilai1 天前
MySQL数据库:表操作
数据库·mysql·adb