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'; |

相关推荐
干就完事了1 天前
Hive内置函数
数据仓库·hive·hadoop
布吉岛没有岛_1 天前
Hadoop学习_week1
大数据·hadoop
lijun_xiao20091 天前
Apache Hadoop-学习笔记1
hadoop·学习·apache
q***07142 天前
Spring Boot 从 2.7.x 升级到 3.3注意事项
数据库·hive·spring boot
阿杜杜不是阿木木2 天前
在 Hadoop 生态使用 JuiceFS,并为Hive提供HDFS存储安装指南
hive·hadoop·hdfs
小坏讲微服务2 天前
MaxWell中基本使用原理 完整使用 (第一章)
大数据·数据库·hadoop·sqoop·1024程序员节·maxwell
一只小青团2 天前
Hadoop之HDFS
大数据·hadoop·分布式
ITVV2 天前
hadoop-3.4.1 单机伪部署
大数据·linux·hadoop
小鹿学程序2 天前
4.子任务四:Hive 安装配置
数据仓库·hive·hadoop
weixin_307779132 天前
基于AWS的应用程序可靠性提升架构优化方案——RDS多可用区与EC2弹性架构实践
数据库·数据仓库·架构·云计算·aws