gpt4 book ai didi

amazon-s3 - 如何处理 Snowflake 中 S3 文件路径中的空格

转载 作者:行者123 更新时间:2023-12-04 04:13:18 26 4
gpt4 key购买 nike

我正在尝试在我们的 S3 存储桶中指定一个特定的文件路径以用于 Snowflake 摄取。

copy into DATABASE.SCHEMA.TABLE
from @SANTABA_ETL_STAGE/Table Name/2020/04/15
pattern='.*[.]csv'
on_error = 'continue'
file_format = csv_etl;

但是由于这个特定文件路径中的空间,我得到了这个错误。

SQL compilation error: syntax error line 2 at position 36 unexpected '/'.

我在文档中找不到任何简单的方法来处理这个问题。有吗?

最佳答案

虽然这看起来是 resolved over comments ,我只是想指出涵盖这种情况的官方文档。

根据 documentation for COPY INTO statements , 要使用包括空格在内的任何特殊字符,需要在舞台或位置文字周围使用单引号。

引用相关部分(截至 2020 年初):

The URI string for an external location (Amazon S3, Google Cloud Storage, or Microsoft Azure) must be enclosed in single quotes; however, you can enclose any string in single quotes, which allows special characters, including spaces, to be used in location and filenames. For example:

-- Stages
copy into '@mystage/path 1/file 1.csv' from mytable;
copy into '@%mytable/path 1/file 1.csv' from mytable;
copy into '@~/path 1/file 1.csv' from mytable;

-- S3 bucket
copy into 's3://mybucket 1/prefix 1/file 1.csv' from mytable;

-- Azure container
copy into 'azure://a.blob.core.windows.net/c/f/file 1.csv' from mytable;

关于amazon-s3 - 如何处理 Snowflake 中 S3 文件路径中的空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61259709/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com