数据导出

1.insert 将查询结果直接导出到本地

insert overwrite local directory "kg/qiaoruihua/hive/emp" select * from student; 
insert overwrite local directory "kg/qiaoruihua/hive/emp2" row format delimited fields terminated by "," select * from student; 

2.insert 将查询结果导出hdfs

insert overwrite  directory "/user/hive/warehouse/emp" select * from student; 
insert overwrite  directory "/user/hive/warehouse/emp2" row format delimited fields terminated by "," select * from student; 

3.利用shell命令导出

hive -e "select * from student" > "/opt/module/datas/student.txt"

4.利用hadoop导出到本地

dfs -get  /user/hive/warehouse/student/student.txt /opt/module/datas/student.txt

5.利用export导出

export table student to "/user/hive/warehouse/export/student";

 

上一篇:hive 基本操作相关


下一篇:方法的重写 override/overwrite