导出hive表数据的5种方法

阅读 11

2023-09-21

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

  1. 本地文件直接导出

insert overwrite local directory '/data/hive/export/student_info' select * from default.student

2.修改分隔符和换行符

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

3.shell 脚本导出

bin/hive -e "select * from default.student_info ;" > /data/hive/export/local/student_info

4.导出数据到文件系统

insert overwrite directory '/data/hive/export/student_info' select * from default.student

5.export 方法

export table student_info partition (country="china") to "/data/hive/export/"

  • 1
  • 2

精彩评论(0)

0 0 举报