如何在 Snowflake 中加载包含多个 zip 文件的 table?

How to load a table with multiple zip files in Snowflake?

我正在尝试使用包含多个 CSV 文件的 zip 文件将数据上传到 Snowflake table,但我不断收到以下消息:

Unable to copy files into table. Found character '\u0098' instead of field delimiter ',' File 'tes.zip', line 118, character 42 Row 110, column "TEST"["CLIENT_USERNAME":1] If you would like to continue loading when an error is encountered, use other values such as 'SKIP_FILE' or 'CONTINUE' for the ON_ERROR option. For more information on loading options, please run 'info loading_data' in a SQL client.

如果我跳过一些数据加载错误,但它就像雪花没有正确打开 zip 文件,我只是得到一些随机字符,就像只用记事本打开 zip 文件一样。

我尝试将文件格式压缩方法更改为所有可用的方法:Auto、Gzip、Deflate、Raw Deflate、Bz2m Brotli、Zstd 和 None。得到不同的错误信息。

我知道我的 Zip 文件是使用标准的 Deflate 压缩方法压缩的,但是当我 select 这种类型时,我收到以下错误:

Invalid data encountered during decompression for file: 'test.zip',compression type used: 'DEFLATE', cause: 'data error' The "Auto" method sends the same error message as None

我也尝试过只包含一个文件的 zip 文件,但我得到了同样的错误。正常工作的文件是一个未压缩的文件 (CSV) 和一个使用 GZ 压缩的文件,但我需要它才能使用包含多个 CSV 的 zip 文件工作

zip 文件不是 DEFLATE 文件,即使 zip 使用 deflate。支持的所有压缩方法都是单个文件压缩方法。 where-as zip 是一个文件存档,因此它有很多文件,这类似于 tar.gz 也不受支持。

因此,您将需要自己在 S3 存储桶中解压缩文件,或者更改数据导出工具以符合要求。

CREATE FILE FORMAT帮助