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

相关推荐
zgl_2005377913 小时前
ZGLanguage 解析SQL数据血缘 之 提取select语句中的源表名
大数据·数据库·c++·数据仓库·sql·数据库开发·etl
宸津-代码粉碎机15 小时前
Spring 6.0+Boot 3.0实战避坑全指南:5大类高频问题与解决方案(附代码示例)
java·数据仓库·hive·hadoop·python·技术文档编写
`林中水滴`17 小时前
Hive系列:Hive 默认分隔符
hive
昌sit!19 小时前
hadoop集群搭建
大数据·hadoop·分布式
yumgpkpm1 天前
银行的数据智能平台和Cloudera CDP 7.3(CMP 7.3)的技术对接
数据库·人工智能·hive·hadoop·elasticsearch·数据挖掘·kafka
`林中水滴`1 天前
Hive系列:Hive 配置项详解
hive
`林中水滴`1 天前
Hive系列:Hive 安装和配置
hive
Hello.Reader1 天前
Flink Catalogs 元数据统一入口、JDBC/Hive/自定义 Catalog、Time Travel、Catalog Store 与监听器
大数据·hive·flink
Hello.Reader1 天前
Flink Modules 把自定义函数“伪装成内置函数”,以及 Core/Hive/自定义模块的加载与解析顺序
大数据·hive·flink
是阿威啊1 天前
【用户行为归因分析项目】- 【企业级项目开发第一站】项目架构和需求设计
大数据·hive·hadoop·架构·spark·scala