導(dǎo)入數(shù)據(jù)到hive表中的6種方式

數(shù)據(jù)導(dǎo)入六種方式

1、加載本地文件到hive表

語法

2、加載hdfs文件到hive中

3、加載數(shù)據(jù)覆蓋表中已有的數(shù)據(jù)

4、創(chuàng)建表時通過select加載

create table if not exists default.dept_cats
as select * from dept;

5、創(chuàng)建表通過insert加載

6、創(chuàng)建表的時候通過location指定加載

外部表方式
create external table if not exists emp_partition(
empno int,
ename string,
job string,
mgr int,
hiredate string,
sal double,
comm double,
deptno int
)
partitioned by (month string)
row format delimited fields terminated by '\t'

load data local inpath '/opt/datas/emp.txt' into table default.emp_partition partition (month='201803');

這樣就可以直接訪問。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容