Hive三种不一样的数据导出的方式

Hive三种不一样的数据导出的方式sql

(1)导出到本地文件系统oop

insert overwrite local directory '/home/hadoop/hbase_table_2' orm

select * from hbase_table_2;hadoop

(2)导出到HDFSit

insert overwrite  directory '/data' table

select * from hbase_table_2;form

(3)导出到hive的另外一个表中  test

insert into table hive_student_test select

select id,name,sex,salary           sql语句

from student;               

在hive0.11.0版本中新引进了一个新的特性

hive> insert overwrite local directory '/root/student'

    > row format delimited                           

    > fields terminated by '\t'                      

> select * from student;    

还能够用hive的-e和-f参数来导出数据,其中-e表示后面直接带双引号的sql语句;而-f是接一个文件,文件的内容为一个sql语句

hive -e "select * from student" >> /root/student11.txt

这个获得的结果也是用\t分割的。也能够用-f实现

hive -f /root/SQL.sql >> /root/student12.txt

相关文章
相关标签/搜索