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

相关推荐
程序员梅雨14 小时前
【从零开始学习数据仓库 | 第二篇】: 拉链表 & 数仓分层
大数据·数据仓库·学习
NiceZack17 小时前
Hadoop 部署全流程教程:从新装 CentOS 到伪分布式与完全分布式
hadoop·分布式·centos
roman_日积跬步-终至千里17 小时前
数仓开发的三层责任:业务定义、模型设计与 SQL 实现
数据库·数据仓库·sql·数据建模
@小匠18 小时前
Flink + Iceberg 批量失败复盘:一次超时如何变成 Hive Metastore 锁泄漏
大数据·hive·flink
geovindu2 天前
SQL Data Sampling and Approximation Techniques using postgreSQL 18
大数据·数据库·数据仓库·sql·postgresql·数据库开发·数据库架构
skywalk81632 天前
hive —— 多机 AI Agent 协同的任务总线:分布式,多节点同时运行,保障不会宕机
人工智能·hive·分布式
程序员梅雨3 天前
【从零开始学习数据仓库 | 第一篇】:维度建模理论
大数据·数据仓库·学习·阿里云·数据分析
棣廷3 天前
初识数据仓库——数仓分层到DataX数据采集
数据仓库
棣廷3 天前
初识Hive(2)
数据仓库·hive·hadoop
skywalk81633 天前
deepseek对skywalk163/hive 和hivecommons/hive 两个多机AI Agent任务调度项目的对比
人工智能·hive·agent