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

相关推荐
Edingbrugh.南空21 小时前
Hive 3.x数据静态脱敏与加密
数据仓库·hive·hadoop
春马与夏1 天前
多参表达式Hive UDF
数据仓库·hive·hadoop
ThisIsClark1 天前
什么是Hive
数据仓库·hive·hadoop
Edingbrugh.南空1 天前
Hive 3.x集成Apache Ranger:打造精细化数据权限管理体系
hive·hadoop·apache
Edingbrugh.南空2 天前
Iceberg与Hive集成深度
数据仓库·hive·hadoop
云淡风轻~~2 天前
Hadoop HDFS存储机制与块大小选择权衡
hadoop·hdfs
Edingbrugh.南空2 天前
Apache Iceberg与Hive集成:分区表篇
大数据·hive·hadoop
Cachel wood2 天前
后端开发:计算机网络、数据库常识
android·大数据·数据库·数据仓库·sql·计算机网络·mysql
AAA建材批发王师傅3 天前
Hive 序列化与反序列化:数据的 “打包“ 与 “拆箱“ 艺术
数据仓库·hive·hadoop
Edingbrugh.南空3 天前
Hive SQL执行流程深度解析:从CLI入口到执行计划生成
hive·hadoop·sql