可以在Redshift中加载一个多个CSV的gzip文件

时间:2021-11-15 23:02:28

I am trying to load a compressed file which contain multiple CSV files into Redshift. I followed AWS documentation Loading Compressed Data Files from Amazon S3. However, I am not sure if I will be able to do following:

我正在尝试将包含多个CSV文件的压缩文件加载到Redshift中。我遵循AWS文档从Amazon S3加载压缩数据文件。但是,我不确定我是否能够做到以下事项:

I have multiple CSV files for a table:

我有一个表的多个CSV文件:

table1_part1.csv
table1_part2.csv
table1_part3.csv

I compressed these three files into one table1.csv.gz.

我将这三个文件压缩成一个table1.csv.gz。

Can I load this gzip file into Redshift table using COPY command?

我可以使用COPY命令将此gzip文件加载到Redshift表中吗?

2 个解决方案

#1


1  

No you cannot; but using copy command you can give a folder name (containing all zip files) or wild card .. So just dont zip them into one file but independent files will work fine.

你不能;但使用复制命令,你可以给一个文件夹名称(包含所有zip文件)或外卡..所以只是不要将它们压缩成一个文件,但独立的文件将正常工作。

#2


0  

You could achieve by creating a Menifest file that should have link of all your CSV files and just specify the Menifest file in your copy command like-

您可以通过创建一个Menifest文件来实现,该文件应包含所有CSV文件的链接,并在复制命令中指定Menifest文件,如:

copy customer
from 's3://mybucket/cust.manifest' 
iam_role 'arn:aws:iam::0123456789012:role/MyRedshiftRole'
manifest;

See Menifest at end.

最后见Menifest。

For more details refer Amazon Red-Shift Documentation. Section "Using a Manifest to Specify Data Files".

有关更多详细信息,请参阅Amazon Red-Shift文档。 “使用清单指定数据文件”一节。

#1


1  

No you cannot; but using copy command you can give a folder name (containing all zip files) or wild card .. So just dont zip them into one file but independent files will work fine.

你不能;但使用复制命令,你可以给一个文件夹名称(包含所有zip文件)或外卡..所以只是不要将它们压缩成一个文件,但独立的文件将正常工作。

#2


0  

You could achieve by creating a Menifest file that should have link of all your CSV files and just specify the Menifest file in your copy command like-

您可以通过创建一个Menifest文件来实现,该文件应包含所有CSV文件的链接,并在复制命令中指定Menifest文件,如:

copy customer
from 's3://mybucket/cust.manifest' 
iam_role 'arn:aws:iam::0123456789012:role/MyRedshiftRole'
manifest;

See Menifest at end.

最后见Menifest。

For more details refer Amazon Red-Shift Documentation. Section "Using a Manifest to Specify Data Files".

有关更多详细信息,请参阅Amazon Red-Shift文档。 “使用清单指定数据文件”一节。