英文:
Unloading from Redshift to S3 in CSV format doesn't create the .csv file
问题
当我从Redshift卸载到S3以CSV格式时,然后当我前往S3中指定的路径时,没有任何.csv文件。我看到的唯一文件是清单文件和000文件。
命令如下:
UNLOAD('select distinct * from mytable')
to 's3://my-bucket/data/myfile'
iam_role 'xxxxxxxxxxxxxxxxxxxxxx'
header
CSV DELIMITER AS '|'
manifest
allowoverwrite
parallel off
查询运行正常,当我前往S3路径时,我看到如下和类型列中的连字符(-):
myfile000
myfilemanifest
难道不应该还有一个.csv文件吗?
谢谢。
我不知道如何继续处理这个问题。
英文:
When I unload from Redshift to S3 in CSV format, then when I go the specified path in s3 there isn't any .csv file. The only files I see are the manifest and the 000 file.
The command is the below
UNLOAD('select distinct * from mytable')
to 's3://my-bucket/data/myfile'
iam_role 'xxxxxxxxxxxxxxxxxxxxxx'
header
CSV DELIMITER AS '|'
manifest
allowoverwrite
parallel off
The query runs fine and when I go the S3 path I see the below and a hyphen (-) in the type column:
myfile000
myfilemanifest
Shouldn't there also be a .csv file?
Thanks.
I don't know how to proceed on this.
答案1
得分: 1
这是Redshift处理文件的方式,它将000
附加到文件名后,但如果你更关心在文件名后附加.csv
扩展名,你可以通过向UNLOAD
命令添加EXTENSION 'extension-name'
选项来实现。
https://docs.aws.amazon.com/redshift/latest/dg/r_UNLOAD.html
所以在你的情况下,可以这样做:
UNLOAD
(
'
select distinct * from mytable
'
)
TO 's3://my-bucket/data/myfile'
iam_role 'xxxxxxxxxxxxxxxxxxxxxx'
header
CSV DELIMITER AS '|'
manifest
allowoverwrite
parallel off
EXTENSION '.csv'
英文:
It's a way how Redshift handles files where it appends 000
to the filename, though if your concern is more to get a .csv
extension appened to the file name you can do so by adding the EXTENSION 'extension-name'
option to the UNLOAD
command
https://docs.aws.amazon.com/redshift/latest/dg/r_UNLOAD.html
So in your case it would be
UNLOAD
(
'
select distinct * from mytable
'
)
to 's3://my-bucket/data/myfile'
iam_role 'xxxxxxxxxxxxxxxxxxxxxx'
header
CSV DELIMITER AS '|'
manifest
allowoverwrite
parallel off
EXTENSION '.csv'
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论