Athena table - 文件路径
Athena table - file's path
我想使用 S3 存储桶在 athena 中创建一个 table,但首先我想知道是否有任何方法可以获取子目录的名称(文件的源数据)作为此 table 中的新专栏。如果是这样,我应该使用哪种语法?如果这不可能,我至少需要该新列中的文件路径。
Power BI 中的映射需要子目录名称。
提前致谢!
来自 Find the Source File for an Athena Table Row:
- To find out which Amazon S3 file contains data that is returned by a specific row in an Athena table, run a
SELECT $path
query.
- To find out which Athena table rows are associated with a specific Amazon S3 file, run a SELECT query with the
WHERE $path
condition.
来自 CREATE EXTERNAL TABLE - Amazon Redshift:
By default, Amazon Redshift creates external tables with the pseudocolumns $path
and $size
. Select these columns to view the path to the data files on Amazon S3 and the size of the data files for each row returned by a query. The $path
and $size
column names must be delimited with double quotation marks. A SELECT *
clause doesn't return the pseudocolumns. You must explicitly include the $path
and $size
column names in your query, as the following example shows:
select "$path", "$size"
from spectrum.sales_part
where saledate = '2008-12-01';
我想使用 S3 存储桶在 athena 中创建一个 table,但首先我想知道是否有任何方法可以获取子目录的名称(文件的源数据)作为此 table 中的新专栏。如果是这样,我应该使用哪种语法?如果这不可能,我至少需要该新列中的文件路径。
Power BI 中的映射需要子目录名称。
提前致谢!
来自 Find the Source File for an Athena Table Row:
- To find out which Amazon S3 file contains data that is returned by a specific row in an Athena table, run a
SELECT $path
query.- To find out which Athena table rows are associated with a specific Amazon S3 file, run a SELECT query with the
WHERE $path
condition.
来自 CREATE EXTERNAL TABLE - Amazon Redshift:
By default, Amazon Redshift creates external tables with the pseudocolumns
$path
and$size
. Select these columns to view the path to the data files on Amazon S3 and the size of the data files for each row returned by a query. The$path
and$size
column names must be delimited with double quotation marks. ASELECT *
clause doesn't return the pseudocolumns. You must explicitly include the$path
and$size
column names in your query, as the following example shows:
select "$path", "$size"
from spectrum.sales_part
where saledate = '2008-12-01';