网站建设推广招代理加盟,顺企网网站建设,网站排名张家港,php网站开发招聘一、知识点
export:将Hive的表导入到mysql叫导出
搜了很多#xff0c;发现sqoop在hive导出到mysql时
1#xff09;不支持where参数对数据进行过滤。
2#xff09;不支持指定hive表的方式导出#xff0c;只能指定Hive目录进行导出。
二、操作
1、在MySQL中建表
creat…一、知识点
export:将Hive的表导入到mysql叫导出
搜了很多发现sqoop在hive导出到mysql时
1不支持where参数对数据进行过滤。
2不支持指定hive表的方式导出只能指定Hive目录进行导出。
二、操作
1、在MySQL中建表
create table my_hive.formal_extract_ren_kou(
years varchar(255),
areas varchar(255),
zheng_shi_indicator varchar(255),
zheng_shi_value varchar(255),
zheng_shi_unit varchar(255)
);
2、在hive中建表
drop table test.test_formal_extract_ren_kou;
create table test.test_formal_extract_ren_kou as
select
years,
areas,
zheng_shi_indicator,
zheng_shi_value,
zheng_shi_unit
from ods.ods_formal
where locate(人口,zheng_shi_indicator)0;
3、将hive表导入到Mysql对应的表
sqoop export \
--connect jdbc:mysql://hadoop4:3306/my_hive \
--username root \
--password 你的密码 \
--table formal_extract_ren_kou \
--columns years,areas,zheng_shi_indicator,zheng_shi_value,zheng_shi_unit \
--export-dir /user/hive/warehouse/test.db/test_formal_extract_ren_kou \
--input-fields-terminated-by \001
;