rajshukla4696
rajshukla4696

Reputation: 106

How to execute HQL commands using .hql files

How to execute hive commands directly from .hql file?

Upvotes: 7

Views: 32621

Answers (4)

Nitin Damle
Nitin Damle

Reputation: 1

hive -f filepath;

example

hive -f /home/Nitin/Desktop/Hive/script1.hql;

Upvotes: 0

Mohamed Khasim
Mohamed Khasim

Reputation: 1

hive -e "show create table default.bulkdata"

Upvotes: -1

sjtu
sjtu

Reputation: 11

Use hive -f filename.hql;

Remember to terminate your command with ;

Upvotes: 1

Connor
Connor

Reputation: 215

As mentioned by @rajshukla4696, both hive -f filename.hql or beeline -f filename will work.

You can also execute queries from the command line via "-e":

hive -e "select * from my_table"

There are plenty of useful command line arguments for Hive that can be found here: Hive Command line Options

Upvotes: 8

Related Questions