sql - Redshift 光谱 : how to import only certain files

标签 sql amazon-redshift amazon-redshift-spectrum

使用 Redshift 光谱时,您似乎只能导入提供位置直到文件夹的数据,并且导入文件夹内的所有文件。

有没有办法从包含多个文件的文件夹中导入仅导入一个文件。当提供带有 filename 的完整路径时,我认为它将文件视为 list 文件并给出错误: list 太大或不支持 JSON。

有没有其他办法?

最佳答案

您无意中回答了自己的问题:使用 list 文件

来自 CREATE EXTERNAL TABLE - Amazon Redshift :

LOCATION { 's3://bucket/folder/' | 's3://bucket/manifest_file' }

The path to the Amazon S3 bucket or folder that contains the data files or a manifest file that contains a list of Amazon S3 object paths. The buckets must be in the same AWS Region as the Amazon Redshift cluster.

If the path specifies a manifest file, the s3://bucket/manifest_file argument must explicitly reference a single file—for example,'s3://mybucket/manifest.txt'. It can't reference a key prefix.

The manifest is a text file in JSON format that lists the URL of each file that is to be loaded from Amazon S3 and the size of the file, in bytes. The URL includes the bucket name and full object path for the file. The files that are specified in the manifest can be in different buckets, but all the buckets must be in the same AWS Region as the Amazon Redshift cluster.



我不确定为什么它需要每个文件的长度。它可用于在多个节点之间分配工作负载。

关于sql - Redshift 光谱 : how to import only certain files,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57337676/

相关文章:

sql - 有什么方法可以使用 LINQ 进行 MDX 查询吗?

MySQL 按连续值和计数分组

sql - 我可以从数据库中的另一列读取间隔值吗

postgresql - 将数据从 S3 复制到 Redshift

amazon-redshift - Redshift 删除表卡住

amazon-redshift - 以Parquet格式将数据文件从Amazon Redshift卸载到Amazon S3

amazon-web-services - 使用胶数据目录中定义的外部表 Redshift 谱

amazon-redshift-spectrum - Redshift 频谱显示所有行的 NULL 值

sql - Postgresql 中的不同类型.. 如何正确执行此操作?

mysql - 通过 id 获取精确值的 SQL 内连接问题