HIVE beeline使用shell 批量执行sql语句

来源:互联网 发布:特价机票 知乎 编辑:程序博客网 时间:2024/05/20 19:18

shell脚本如图所示:

principal:代表的是认证方式

#!/bin/sh#--------------------------------------------#Date:#Author:#------------------------------------------------################################################. /etc/profile. ~/.bash_profile################################################sql14_pc="insert into table uv_daybyday_bylimin select 20170814,count(t.uv),'pctotal' from (select uv from UV_TOTAL_DAY_BYLIMIN where dt between 20170813 and 20170814 group by uv) t;"sql15_pc="insert into table uv_daybyday_bylimin select 20170815,count(t.uv),'pctotal' from (select uv from UV_TOTAL_DAY_BYLIMIN where dt between 20170813 and 20170815 group by uv) t;"#调用hive, 执行上面的sql/usr/lib/hive/bin/beeline -u "jdbc:hive2://10.10.10.10:10000/bd_warehouse;principal=bd-warehouse" --hiveconf mapreduce.job.queuename=datacenter  -e "${sql14_pc}" -e "${sql15_pc}" 

原创粉丝点击