Home > OS >  How to pass env variable in hive script?
How to pass env variable in hive script?

Time:05-31

I have a hql script with test.hql in that i'm having env variable like this in query date='${env:date}' how can i pass an argument to the hql if it is hiveconf or hivevar we run script like

hive -f --hiveconf date='20220526' test.hql

can some one tell how will we pass env variable

hive -f --env date='20220526' test.hql

i'm not able to pass like above

CodePudding user response:

Environment variables would be interpreted by the shell, not a query.

export DATE='20220526' 
hive -f --hiveconf date="$DATE" test.hql

Also, beeline should be used rather than deprecated Hive cli

  • Related