AWS Redshift Spectrum - 如何在外部 table 中获取 s3 文件名

AWS Redshift Spectrum - how to get the s3 filenames in the external table

我在 AWS spectrum 中创建了外部表来查询 s3 数据,但是我无法识别记录所属的文件名(我在一个存储桶下有数千个文件)

在 AWS Athena 中,我们有一个伪列“$PATH”,它将显示 s3 文件名,在使用 spectrum 时是否有类似的方法可用?

最近,您可以使用特定的伪列来访问 S3 中对象的路径和大小以获取沿袭信息。

http://docs.aws.amazon.com/redshift/latest/dg/c-spectrum-external-tables.html#c-spectrum-external-tables-pseudocolumns

此类查询的示例如下:

>> select distinct "$path", "$size" from spectrum.sales_part;

 $path                                 | $size
---------------------------------------+-------
s3://awssampledbuswest2/tickit/spectrum/sales_partition/saledate=2008-01/ |  1616
s3://awssampledbuswest2/tickit/spectrum/sales_partition/saledate=2008-02/ |  1444
s3://awssampledbuswest2/tickit/spectrum/sales_partition/saledate=2008-02/ |  1444