How to save Amazon Redshift output to local CSV through SQL Workbench?
I know your question is about Workbench but if you are willing to go to command line on linux possibly this is a solution, it's working nicely for us
#!/bin/zsh
#we are assuming you are not appending to each file and you don't need header
out_put='/tmp/output.csv'
#be very careful here rm -rf is very dangerous
rm -rf $out_put
PGPASSWORD='YOUR_PASSWORD' psql -h YOUR_STUFF-cluster-1.YOUR_STUFF.us-east-1.redshift.amazonaws.com -p YOUR_PORT_NUMBER -d YOUR_DATABASE -U YOUR_USER_NAME -A -t -c "select * from SOME_TABLE limit 10" -F ',' -o $out_put
echo "your file is ready" $out_put
Yes there is, try this out.
PGPASSWORD=<password> psql -h <host> -d <db> -U <user> -p 5439-a -c "select * from <table>" -F '<delimiter>' -o temp.csv
Try running any one of the following in the Workbench
WbExport -type=text
-file='C:\Downloads\myData.txt'
-delimiter='\t'
-decimal=','
-dateFormat='yyyy-MM-dd';
select a, b ,c from myTable;
WbExport -type=text
-file='C:\Downloads\myQuery.txt'
-delimiter='\t'
-header=true
-tableWhere="WHERE a is not null and date between 11/11/11 and 22/22/22"
-sourcetable=mytable;