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

相关推荐
添柴少年yyds4 小时前
hive锁机制
数据仓库·hive·hadoop
蓝眸少年CY4 小时前
Hive - 安装与使用
数据仓库·hive·hadoop
旺仔小拳头..1 天前
Servlet概念与创建
数据仓库·hive·hadoop
旺仔小拳头..1 天前
Filter 过滤器 与Listener 监听器
数据仓库·hive·hadoop
Leo.yuan1 天前
实时ETL怎么做?有哪些好用的ETL工具?
数据仓库·etl
晨晖21 天前
Servlet的快速入门,请求和响应
hive·hadoop·servlet
AllData公司负责人1 天前
AllData数据中台通过集成DolphinScheduler+Seatunnel实现SAP HANA数据库同步到Doris数据仓库
数据库·数据仓库·sap hana
yumgpkpm1 天前
AI算力纳管工具GPUStack Server+华为鲲鹏+麒麟操作系统 保姆级安装过程
人工智能·hadoop·华为
`林中水滴`1 天前
【数据仓库】Iceberg、Hudi、Delta Lake、Paimon:四大开源湖表格式怎么选?
数据仓库
黄昏回响1 天前
计算机系统基础知识(补充篇):数据库——数据仓库、数据中台与大数据技术详解
大数据·数据库·数据仓库