0

I have to implement a CR, where i have to unload around 180 tables of Redshift cluster. I have all Unload command, which I'm going to execute one by one.

It would be great if I do get some work-around over this issue.

Reference document: Unloading Data to Amazon S3

Sample command:

unload ('select column1, column2 from table') to 's3://prod/audi/history/20150914/fact_invite2_audi_' credentials '<>' MANIFEST GZIP ESCAPE DELIMITER AS ',' ; 
3
  • 1
    Welcome to StackOverflow! Could you please clarify your actual question? What do you mean by "get some work-around over this issue"? What is your "issue"? Commented Nov 23, 2016 at 20:01
  • Hello John, Can i unload multiple tables in one single command/script ? If yes, please let me know the way. I have to unload around 185 tables. As of now i am doing it by running UNLOAD command one by one. Commented Nov 24, 2016 at 8:32
  • Hi @RoshanNagpure there are no Redshift commands to unload multiple tables. You will need to write a quick iterator in a scripting language of your choice to create all the necessary statements. Commented Nov 25, 2016 at 20:32

2 Answers 2

2

The Amazon Redshift UNLOAD command only exports the results of one SELECT statement. The statement can reference multiple Redshift tables, but will not export the data as separate outputs.

Some options:

  • Send one request with multiple UNLOAD statements, separated by semi-colons. They will be executed sequentially, but it's easier to issue.
  • Run simultaneous requests. Each would need a separate JDBC connection, but the requests would run concurrently, based upon Workload Management queue configurations.
Sign up to request clarification or add additional context in comments.

Comments

0

I have recently implemented this with the help of stored procedure.

What we’ll achieve with this?

  1. Unload many tables to S3.
  2. Unload all the tables in a specific schema.
  3. Unload specific tables in any schema.
  4. All the tables in all the schema.

All detailed steps are here: https://thedataguy.in/redshift-unload-multiple-tables-schema-to-s3/

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.