How to write a script file in Hive?

2019-07-08 23:46发布

I am a newbie to Hive and trying to write a script file which contains 3 queries in it.I have already created the table in /user/hive/warehouse(default database).I am not sure where to save the script file and what command to use to execute it?Looking forward for a solution. Info:I am working on hive-ubuntu. Thanks Sweesha

标签: hive
1条回答
疯言疯语
2楼-- · 2019-07-09 00:51

in local FS :

/home/username/some/path/Query1.q (.hql) -- inside it query is "show databases;"

(give all three Queries in one file if needed)

from shell $:

user@hostname $ $HIVE_HOME/bin/hive -f /home/username/some/path/Query1.q
OK
database_name
db
default
financials
mydb

from hive CLi :

hive> source /home/username/some/path/Query1.q

查看更多
登录 后发表回答