hive 下载和导入数据 hive -e

 

1. 从97导出dim_channel_terminal_flag表数据到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_cmo_user_buyview_kpi_report_di_2016-03.txt' overwrite into table cmo_app.app_cmo_user_buyview_kpi_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');

 

 

你可能感兴趣的:(开源项目,hive)