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

相关推荐
It's Q1 小时前
hive学习分区&&函数
hive·hadoop·学习
隐于花海,等待花开3 小时前
5.TRIM / LTRIM / RTRIM 函数深度解析
大数据·hive
RestCloud4 小时前
TiDB 混合负载场景下的 ETL 与 CDC 实践
数据仓库·tidb·etl·cdc·数据同步·数据库传输
lifewange5 小时前
Hadoop 全套常用 Shell 命令完整版
大数据·hadoop·npm
lifewange5 小时前
Hadoop 完整入门详解
大数据·hadoop·分布式
菜鸟小码1 天前
Hive数据模型、架构、表类型与优化策略
hive·hadoop·架构
AllData公司负责人1 天前
AllData数据中台通过开源项目RustFS建设现代数据湖存储,接入工业, 医疗, 物联网数据,包括文件/图像/音频/视频数据!
数据库·数据仓库·物联网·开源·数据存储·数据接入·rustfs
IT从业者张某某1 天前
基于Docker的hadoop容器安装hive并测试
hive·hadoop·docker
IT从业者张某某1 天前
基于Docker的hadoop容器安装zookeeper
hadoop·docker·zookeeper
juniperhan1 天前
Flink 系列第14篇:Flink Metrics 监控指标详解(生产环境版)
大数据·数据仓库·分布式·flink