I want to export the ouput of Unload command in Redshift to CSV format but it only gives option to produce a gzip file
1 Answer
CSV (comma separated values) and Gzip (compression format) are separate things. Your output file can easily be both CSV and Gzip compressed.
If you want uncompressed CSV files then you can specify DELIMITER AS ',' and leave off the GZIP option in your UNLOAD statement.
UNLOAD ('SELECT * FROM venue') TO 's3://mybucket/venue_tab_' CREDENTIALS 'aws_access_key_id=<access-key-id>;aws_secret_access_key=<secret-access-key>' DELIMITER AS ',' ; 1 Comment
user3085988
Thanks for the answer, its really helpful. Can you please tell me what to do If I want the file with .csv extension. Because when I use the option "PARALLEL OFF" and save the file as XYZ.csv as in (TO 's3://mybucket/XYZ.csv '), the actual output file comes as XYZ.csv000 and I have to convert its extension manually every time after downloading. Thanks in advance