Hive tips and shortcuts

 

#execute a query in Silent(S)Mode

 hive -S -e "your hive query"

 

#execute a query

 hive -e "your hive query"

 

#show current database

 hive>set hive.cli.print.current.db=true;

 

#show all column names for a table

 hive>set hive.cli.print.header=true;

 

#to run all pre required commands in one go

1.create .hiverc file in your root directory.

2.put all commands in .hiverc file.

Now all commands will run when you enter in to hive.

 

#run shell commands without exiting hive

  1. put ! before shell commands.

Examples:-

hive> ! hadoop fs -ls ;

hive> ! ls ;

 

#run a hql file in Hive CLI

 hive> source <location_Of/hql_File>

 

#run a hql file in unix:

 hive -f <location_Of/hql_File>

 

#you can save hive query file with extension .q or .hql;

Don’t miss the tutorial on Top Big data courses on Udemy you should Buy

Sharing is caring!

Subscribe to our newsletter
Loading

Leave a Reply