load data
'/user/huangxgc/hive/datas/emp.txt overwrite into table default.emp;
4) 建立表時通過insert 載入
create table
default
.emp like emp
insert
into
select
*from
emp;
5) 建立表的時候通過location指定載入
insert overwrite
local
directory
'/opt/datas/hive_exp_emp'
select
*from
default
.emp
;
insert overwrite
local
directory
'/opt/datas/hive_exp_emp'
row format delimited fields terminated
by'\t' # 行內個字段採用製表符進行分割
collection items terminated by '\n' # 每行採用換行進行分割
select
*from
default
.emp
;
bin
/hive -e
"select *from default.emp;"
>
/opt/
datas
/exp_res
.txt
兩個專用匯出匯入
語法:
export table tablename
[partition
(part_column
="value"
[,....])]
to
'exportt_target_path'
export_target_path:指的是hdfs的路徑
語法:
import
[external
]table new_or_original_tablename
[partition
(part_column
="value"
[....])]
from
'source_path'
[
location
'import_target_path'
]
import_target_path:指的是hdfs的路徑
Hive資料匯入和匯出
1.將select的結果放到乙個的的 中 首先要用create table建立新的 insert overwrite table test select uid,name from test2 2.將select的結果放到本地檔案系統中 insert overwrite local director...
Hive 匯入匯出資料
將檔案中的資料載入到表中 load data local inpath examples files kv1.txt overwrite into table pokes 載入本地資料,同時給定分割槽資訊 load data local inpath examples files kv2.txt o...
hive資料匯入匯出
hive官方提供兩種匯入資料的方式 1 從表中匯入 insert overwrite table test select from test2 2 從檔案匯入 2.1 從本地檔案匯入 load data local inpath hadoop aa.txt overwrite into table ...