Saving hive requests

I need to know how we can save the query that I wrote on the command line, as in sql (we use ctrl + S in the sql server).

I heard that QL queries for hive use the .q or .hql extension. Is it possible to save my request in order to get the same, keeping a list of commands that I execute.

+5
source share
3 answers

sure no matter what you use, you can just save the file as myfile.q and then run it from the command line as

hive -f myfile.q 

You can also do

 hive -f myfile.q > myfileResults.log 

if you want to transfer the results to a log file.

+4
source

Create a new file using the "cat" command (you can even use the editor). Write down all the queries you want to execute inside the file

 $cat > MyQueries.hql query1 query2 . . Ctrl+D 

Note: .hql or .q is not required. It is simple for our reference to determine that this is a request (file) for bushes.

You can execute all the requests inside the file at a time using

 $hive -f MyQueries.hql 
+1
source

You can use a hue or web interface to access the hive instead of a terminal. It will provide you with an interface from which you can write and execute queries. Solves the problem with copies.

http://gethue.com/

https://cwiki.apache.org/confluence/display/Hive/HiveWebInterface

0
source

Source: https://habr.com/ru/post/1243320/


All Articles