[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"
相关推荐
鲁子狄2 小时前
[笔记] 动态 SQL 查询技术解析:构建灵活高效的企业级数据访问层
java·spring boot·笔记·sql·mysql·mybatis
Dubhehug3 小时前
8.数据库索引
数据库·mysql·索引·索引分类·索引优缺点
冬夜戏雪3 小时前
阿里云ubuntu安装mysql docker容器(拉,运行,测试完整版)
mysql·ubuntu·阿里云
楼兰胡杨3 小时前
MySQL 更新字段的值为当前最大值加1
mysql
♡喜欢做梦4 小时前
【MySQL】索引
数据库·mysql
都叫我大帅哥4 小时前
📉 MySQL索引罢工事件簿:揭秘失效原因与优化起义方案
java·mysql
什么半岛铁盒4 小时前
MySQL数据库的基础操作
linux·运维·服务器·mysql
fengye2071617 小时前
板凳-------Mysql cookbook学习 (十一--------10)
学习·mysql·adb
kfepiza13 小时前
Debian-10编译安装Mysql-5.7.44 笔记250706
linux·数据库·笔记·mysql·debian·bash
不剪发的Tony老师13 小时前
phpMyAdmin:一款经典的MySQL在线管理工具又回来了
数据库·mysql·phpmyadmin