导出hive表数据的5种方法

下面介绍一下hive 导出的几种方式

  1. 本地文件直接导出
insert overwrite local directory '/data/hive/export/student_info' select * from default.student 
  1. 修改分隔符和换行符
insert overwrite local directory '/data/hive/export/student_info' 
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' COLLECTION ITEMS TERMINATED BY '\n'
select * from default.student 
  1. shell 脚本导出
bin/hive -e "select * from default.student_info ;" > /data/hive/export/local/student_info
  1. 导出数据到文件系统
insert overwrite directory '/data/hive/export/student_info' select * from default.student 
  1. export 方法
    export table student_info partition (country="china") to "/data/hive/export/"

欢迎关注,更多福利

这里写图片描述

猜你喜欢

转载自blog.csdn.net/u012957549/article/details/85313421