How to unload a table on RedShift to a single CSV file?

后端 未结 5 608
醉话见心
醉话见心 2021-02-02 11:36

I want to migrate a table from Amazon RedShift to MySQL, but using \"unload\" will generate multiple data files which are hard to imported into MySQL directly.

Is there

5条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-02 12:18

    Nope. { You can use a manifest and tell Redshift to direct all output to a single file. } Previous answer was wrong, I had used manifests for loading but not unloading.

    There appears to be 2 possible ways to get a single file:

    1. Easier: Wrap a SELECT … LIMIT query around your actual output query, as per this SO answer but this is limited to ~2 billion rows.
    2. Harder: Use the Unix cat utility to join the files together cat File1.txt File2.txt > union.txt. This will require you to download the files from S3 first.

提交回复
热议问题