1.从hive中查询并导出为txt文件到Linux服务器上:
hive -e "select * from xj6500.fct_vecl_insur_pft_2 where daypt between '2017-10-31' and '2017-11-28'" > /home/data/hiveexport/fct_vecl_insur_pft_3/fct_vecl_insur_pft_3.txt;
2.直接执行hql文件
hive -f /opt/xj6500_data/hive_sql/updatesql.hql
编码后:
hive\u0020-f\u0020/opt/xj6500_data/hive_sql/updatesql.hql
3.从文本向数据库表加载数据(注意:此时的表类型必须为textfile格式)
load data local inpath '/opt/spacewalk/hy_test.txt' into table test_hy2;
4.从hive中查询并到出txt文件到hdfs上
insert overwrite local directory '/data/spacewalk/origin_file/hive/dim_agent_l1_channel' ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' STORED AS TEXTFILE select * from dim_agent_l1_channel;