I want to run query stored file in beeline. This code works OK in putty.
beeline -u "hiveserver" -n "username" -p "password" --outputformat=csv2 --silent=true -e "select * from table;" >output1.txt
When I save sql command to query.hql or query.sql and upload to server where hadoop is, command does not export anything. I get no error.
beeline -u "hiveserver" -n "username" -p "password" --outputformat=csv2 --silent=true -f query.hql >output1.txt
Query in file works when I run it as !run query.hql
directly in beeline.
What is wrong with my query in file approach?
Make sure you have a new line character at the end of the file. Otherwise, beeline will not execute that command rather will just print onto the beeline terminal. Please let me know if that works.
Please, check if below is the case.