RICH-ATONE

Hive通过-f调用sql文件并进行传参

Hive通过-f调用sql文件并进行传参
test.sql 示例:
select * from dwd.test where dt='${hiveconf:dt}' and gn='${hiveconf:gn}' limit 10 ;

传参示例:

~/bin/hive -hiveconf dt=2022-01-18 -hiveconf  gn=xxx  -f ~/test.sql 2>&1   > ./result.csv

观察 result.csv 执行结果查看,数据执行正确;

 

posted on 2024-01-19 14:01  RICH-ATONE  阅读(24)  评论(0编辑  收藏  举报

导航