如何在 Athena table 上执行 SHOW PARTITIONS 命令?

How do I execute the SHOW PARTITIONS command on an Athena table?

我第一次将 AWS Athena 与 AWS Glue 结合使用,S3 提供了一个 'folder' 结构,该结构映射到我的数据中的分区 - 我正在了解概念,所以请原谅任何错误描述!

我正在查看将数据添加到我的 S3 存储桶并发现新文件夹被忽略时发生的情况。深入挖掘后,我遇到了 'SHOW PARTITIONS' 命令,如此处所述 https://docs.aws.amazon.com/athena/latest/ug/show-partitions.html,并且我正在尝试使用 Athena 查询编辑器针对我的测试表执行此命令,同时考虑到我将继续使用'ALTER TABLE ADD PARTITION' 命令添加新的 S3 文件夹。

我正在尝试在 AWS Athena 控制台查询编辑器中执行 'SHOW PARTITIONS' 命令:

SHOW PARTITIONS "froms3_customer-files"."unit"

但是当我尝试执行它时,我看到这条消息:

line 1:17: missing {'from', 'in'} at '"froms3_customer-files"' (service: amazonathena; status code: 400; error code: invalidrequestexception; request id: c0c0c351-2d42-4da4-b1f3-223b1733db65)

我很难理解这告诉我的是什么,有人可以帮我吗?

Athena 不支持数据库名称中的连字符。

Athena table, view, database, and column names cannot contain special characters, other than underscore (_).

同时从 show partitions 命令中删除双引号。

SHOW PARTITIONS froms3_customer_files.unit

参考文献:

Athena table and database naming convention

Athena show partitions

如果你想查看到目前为止创建的所有分区,你可以使用以下命令

SHOW PARTITIONS DB_NAME.TABLE_NAME

如果你想查看table分区的键,你可以通过UI查看它,方法如下:

1.单击 table 菜单选项。

2。单击显示属性

3。点击分区查看分区。