[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"
相关推荐
半路_出家ren1 天前
图书销售系统数据库设计方案
数据库·mysql·子查询·ddl·dml·数据库设计·分组查询
ayaya_mana1 天前
MySQL忘记Root密码,详细找回密码步骤
数据库·mysql·adb
顾三殇1 天前
【MySQL】win 10 / win11:mysql 5.7 下载、安装与配置
数据库·mysql
用户6120414922131 天前
使用JSP+Servlet+JavaBean做的课程后台管理系统
java·javascript·mysql
Jtti1 天前
如何通过检查MySQL与系统日志以找出服务器CPU占用源
服务器·mysql·adb
Elias不吃糖1 天前
Qt 6以上版本都试用 连接 MySQL 数据库全流程(CMake 环境)
数据库·qt·mysql
不是二师兄的八戒1 天前
MySQL 中 HAVING 子句的深度解析与实战指南
数据库·mysql
座山雕~1 天前
MYSQL-超全基础以及用法--仅个人的速记笔记(1)
数据库·mysql
FJW0208141 天前
关系型数据库大王Mysql——DML语句操作示例
数据库·mysql
舰长1151 天前
ubuntu24安装mysql遇到的坑----解决Mysql报错缺少libaio.so.1
linux·mysql·ubuntu