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'

参考教程

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章