hive表中的数据导出 多种方法详细说明

​​​​​​文章中对hive表中的数据导出 多种方法目录

方式一:insert导出

[方式二:hive shell 命令导出](#方式二:hive shell 命令导出)

方式三:export导出到HDFS上


目标:

将hive表中的数据导出到其他任意目录,例如linux本地磁盘,例如hdfs,例如mysql等等

方式一:insert导出

1)将查询的结果导出到本地

|--------------------------------------------------------------------------------------------------------------------|
| insert overwrite local directory '/export/data/hive_data/exporthive' select * from score**;** |

2)将查询的结果格式化导出到本地

|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| insert overwrite local directory '/export/data/hive_data/exporthive' row format delimited fields terminated by '\t' collection items terminated by '#' select * from student**;** |

3)将查询的结果导出到HDFS上(没有local)

|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| insert overwrite directory '/export/data/hive_data/exporthive' row format delimited fields terminated by '\t' select * from score**;** |

方式二:hive shell 命令导出

基本语法:(hive -f/-e 执行语句或者脚本 > file)

|-----------------------------------------------------------------------------------------------------------------------------|
| bin / hive - e "select * from myhive.score;" > /export/data/hive_data/exporthive / score**.** txt |

方式三:export导出到HDFS上

|---------------------------------------------------------------|
| export table score to '/export/exporthive/score'; |

相关推荐
nvd1111 小时前
折腾 Niri WM:手搓一个完美的多显示器下拉终端 (Drop-down Terminal)
数据仓库
QQ129584550412 小时前
FERP50 - Excel以存储过程方式访问数据仓库
数据仓库·spark·excel
It's Q12 小时前
Hive序列函数&&排名函数
数据仓库·hive·hadoop
Irene199112 小时前
外部表(EXTERNAL_TABLE)Hive 借用数据,删表不删数据
hive·内部表·外部表
WL_Aurora1 天前
Hadoop HA高可用架构深度解析
大数据·hadoop·架构
Irene19911 天前
Windows 11 WSL Ubuntu 环境:实际安装 Hive 踩坑实录
hive·windows·ubuntu
Irene19911 天前
Windows 11 WSL Ubuntu 环境:实际安装 Hadoop 踩坑实录
linux·hadoop·ubuntu
Irene19911 天前
(课堂笔记)Hive 分区、分桶与数据倾斜
hive·hadoop
Irene19912 天前
在 WSL Ubuntu 上安装和使用 Hive
linux·hive·ubuntu
二宝哥2 天前
大数据之安装Hadoop3.1.4
大数据·hadoop