数仓数据导出到mysql_Hive数据仓库之快速入门

Hive定位:ETL(数据仓库)工具

将数据从来源端经过抽取(extract)、转换(transform)、加载(load)至目的端的工具,如像:kettle

有关Hive数据导入导出mysql的问题请查看《如何利用sqoop将hive数据导入导出数据到mysql》

DML

批量插入/批量导入

LOAD DATA [LOCAL] INPATH 'filepath' [OVERWRITE] INTO TABLE tablename [PARTITION (partcol1=val1, partcol2=val2 ...)]

注:filepath可以是hdfs路径或者是S3路径,如hdfs://namenode:9000/user/hive/project/data1

1.从本地文件导入到表

load data local inpath 'test.txt' into table test;

2.从hdfs导入到表

load data inpath '/home/test/add.txt' into table test;

3.从表查询中导入到表

insert into table test select id, name, tel from test;

4.将查询数据导入到多个表

from source_table

insert into table test select id, name, tel from dest1_table select src.* where src.id < 100

insert into table test select id, name, tel from dest2_table select src.* where src.id < 100

insert into table test select id, name, tel from dest3_table select src.* where src.id < 100;

5.建表时导入

create table test4 as select id, name, tel from test;

指定分隔符导出数据

insert overwrite local directory '/home/hadoop/export_hive'

row format delimited

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值