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

相关推荐
TTBIGDATA20 小时前
【Ambari Plus】15.Livy 安装
大数据·运维·hadoop·ambari·hdp·cdh·bigtop
Direction_Wind20 小时前
如何从零设计一套数据仓库
数据仓库
李昊哲小课21 小时前
Ubuntu26.04-Hadoop3.5.0搭建hive4.2.0
数据仓库·hive·数仓
李昊哲小课1 天前
Ubuntu26.04-Hadoop3.5.0搭建Hbase2.6.6集群
hadoop·hbase
我登哥MVP1 天前
Hadoop成长史-从Nutch子项目到大数据生态王者
java·大数据·hadoop·分布式·云原生·云计算
我登哥MVP1 天前
HDFS硬核拆解-读写Pipeline与Java实战
java·hadoop·hdfs·云原生·云计算
ljs6482739511 天前
VMware 中部署 HDFS 集群环境(Hadoop 3.4.3)完整指南
大数据·hadoop·hdfs
斯文的八宝粥2 天前
WPF企业内训全程实录(下)
大数据·hadoop·wpf
Zhu7582 天前
使用腾讯CNB构建Hadoop定制容器镜像
大数据·hadoop·分布式
TTBIGDATA2 天前
【Ambari Plus】13.Spark 安装
大数据·hadoop·分布式·spark·ambari·sqoop·ambari plus