Xianyi Ye
Xianyi Ye

Reputation: 1043

How to export Redshift table data to local file via JDBC?

Is there anyway could export redshift table data into a local file as dump via JDBC?

Thanks

Upvotes: 2

Views: 2526

Answers (2)

aaronsteers
aaronsteers

Reputation: 2571

The most performant way to extract data is not through JDBC but using the UNLOAD command to dump data into Amazon S3. After the data is extracted, you can then download it directly from S3, as needed. By using JDBC you will be limited by I/O and network performance. UNLOAD benefits from parallelization and very low-level, high-throughput connections between Redshift (EC2, actually) and S3.

Examples: http://docs.aws.amazon.com/redshift/latest/dg/r_UNLOAD_command_examples.html

Upvotes: 1

John Rotenstein
John Rotenstein

Reputation: 270104

The application you are using to connect to Redshift via JDBC would be responsible for saving the data to a "local file".

For example, it could send a SELECT * FROM <table> command to Redshift. The data is then returned to the application, which could then save it to disk.

Take a look at apps such as SQL Workbench/J, DBVisualizer and Aginity. They should all offer that capability.

Upvotes: 0

Related Questions