Question

I'm trying to move a file from RedShift to S3. Is there an option to move this file as a .csv?

Currently I am writing a shell script to get the Redshift data, save it as a .csv, and then upload to S3. I'm assuming since this is all on AWS services, they would have an argument or something that let's me do this.

Était-ce utile?

La solution

Use the UNLOAD command. It will create at least one file per slice, you will have to merge the files by yourself.

unload ('__SQL__')
to 's3://__BUCKET__/__PATH__'
credentials 'aws_access_key_id=__S3_KEY__;aws_secret_access_key=__S3_SECRET__'
delimiter as ','
addquotes
escape
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top