irpas技术客

Hive导入数据的五种方式_程序遠_hive导入数据

未知 4919

1. Load方式,可以从本地或HDFS上导入,本地是copy,HDFS是移动

本地:load data local inpath ‘/root/student.txt’ into table student; HDFS:load data inpath ‘/user/hive/data/student.txt’ into table student;

2. Insert方式,往表里插入

insert into table student values(1,’zhanshan’);

3. As select方式,根据查询结果创建表并插入数据

create table if not exists stu1 as select id,name from student;

4. Location方式,创建表并指定数据的路径

create external if not exists stu2 like student location '/user/hive/warehouse/student/student.txt';

5. Import方式,先从hive上使用export导出在导入

import table stu3 from ‘/user/export/student’;


1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,会注明原创字样,如未注明都非原创,如有侵权请联系删除!;3.作者投稿可能会经我们编辑修改或补充;4.本站不提供任何储存功能只提供收集或者投稿人的网盘链接。

标签: #hive导入数据 #1 #data #local #inpath #rootstudenttxt #into