mysql数据导入到hive表中

在Hive中创建xd_phy_course数据表,其数据表结构如下表所示。使用Sqoop工具将MySQL中xiandian数据库下xd_phy_course表导入到Hive数据仓库中的xd_phy_course表中。在这里插入图片描述

1,先创建一个hive表,

create table h2 (stname string,stID int,class string,opt_cour string) row format delimited fields terminated by '\t' lines terminated by '\n';

2,用sqoop工具将mysql中的数据转移到hive表中,这里创建mysql表在mysql表

sqoop import --connect jdbc:mysql://localhost:3306/xiandian --username root --password bigdata --table m1 --hive-import --hive-overwrite --hive-table h2 -m 1 --fields-terminated-by '\t' --lines-terminated-by '\n'

参考教程

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值