What is the syntax to save a vertica query to a file when run from the vsql prompt and without logging into adminTools?
To save a vertica query to a file when run from the vsql prompt and without logging into adminTools you can do the following:
1. Log on to the data repository
2. Change to the dradmin user (su - dradmin)
3. cd /opt/vertica/bin
4. Run the following query:
./vsql -U<user> -w<password> -c 'query;' > /tmp/filename.txt
Example:
./vsql -Udradmin -wdbpass -c 'select database_name from databases;' > /tmp/database.txt
Output:
cat /tmp/database.txt
database_name
---------------
drdata
(1 row)