加载数据

https://www.cnblogs.com/bjlhx/p/6946422.html

https://blog.csdn.net/m0_49092046/article/details/109251015

1 load

1
load data [local] inpath ‘/opt/module/datas/student.txt’ [overwrite] | into table tabName [partition (partcol1=val1,…)];

(1)load data:表示加载数据
(2)local:表示从本地加载数据到 hive 表;否则从 HDFS 加载数据到 hive 表
(3)inpath:表示加载数据的路径
(4)overwrite:表示覆盖表中已有数据,否则表示追加
(5)into table:表示加载到哪张表
(6)tabName:表示具体的表
(7)partition:表示上传到指定分区

例子:

1
load data inpath '/origin_data/gmall/log/topic_log/2020-06-14' into table ods_log partition(dt='2020-06-14')

2 INSERT

https://help.aliyun.com/document_detail/73775.html

insert into 和insert overwrite

1
2
3
4
5
6
1
insert into table student partition(month='20201022') values(1,'zhangsan');
2
insert overwrite table student partition(month='20201023')
select id, name from student where month='20201023';

Author

Lavine Hu

Posted on

2022-04-02

Updated on

2022-04-04

Licensed under

# Related Post
  1.hql增删改查
  2.hive优化
  3.hql常见操作
  4.函数
  5.建表
  6.hive数据导入导出
Comments

:D 一言句子获取中...