hive下载和导入数据hive -e

数据下载

1. 从hive命令行导出表数据到txt(数据下载)
hive -e 'select * from dim.dim_city' >> dim_city.txt  
hive -e "select * from app.app_cmo_user_buyview_kpi_report_di where dt='2016-03'" >> app_cmo_user_buyview_kpi_report_di_2016-03.txt  

数据上传

2.load文件至hadp

ssh [email protected]
123456

hive  
load data local inpath '/home/hadp/niewj/app_report_di_2016-03.txt' overwrite into table cmo_app.app_report_di partition (dt='2016-03');  
load data local inpath '/home/hadp/wenxiaomin/app_cmo_datacube4_ord_type_det_sum_di1.txt' overwrite into table cmo_app.app_cmo_datacube4_ord_type_det_sum_di partition (dt='2016-02-02',tp='1');  
load data local inpath '/home/hadp/wenxiaomin/app_cmo_coupon_send_dept_di.txt' overwrite into table cmo_app.app_cmo_coupon_send_dept_di partition (dt='2016-02-02');  
load data local inpath '/home/hadp/niewj/app_cmo_user_buyview_lv_cd_kpi_di.txt' overwrite into table cmo_app.app_cmo_user_buyview_lv_cd_kpi_di partition (dt='2015-01'); 

[2016-09-20]

你可能感兴趣的:(hive)