I am trying to access hive table and dump the result back into text file. And when I try to do this, I always get the permission denied? Is there something I am missing?
bash-3.00$ 'select * from ATTRIBUTE_DATA_REALTIME LIMIT 10' > test.txt
bash: test.txt: Permission denied
And what permission I need in this case? Or my query is wrong?
Firstly — you’re missing a
hive -e. With what you have now, Bash will look for a program namedselect * from ATTRIBUTE_DATA_REALTIME LIMIT 10!But as for the permissions issue, there are two possibilities:
test.txtalready exists, then you need to run your command as a user that has permission to write to the file. (Usels -l test.txtto see who owns the file and what the permissions on it are.)test.txtdoesn’t already exist, then you need to run your command as a user that has permission to write to the directory containing the file, i.e., the current directory. (Usels -ld .to see who owns the directory and what the permissions on it are.)