简体   繁体   English

删除名称中带有 `.` 的 AWS Athena 表

[英]Drop AWS Athena table with `.` in the name

I had a client upload a malformed table with a name like foo.bar into an Athena instance.我让一个客户将一个名称像foo.bar的格式错误的表上传到一个 Athena 实例中。 What syntax can I use to drop the table?我可以使用什么语法来删除表? If I try如果我尝试

drop table if exists `foo.bar`

The command silently fails, presumably because the parser interprets foo as the database name.该命令静默失败,可能是因为解析器将foo解释为数据库名称。 If I try adding the database name explicitly as如果我尝试将数据库名称显式添加为

drop table if exists dbname."foo.bar"

or或者

drop table if exists dbname.`foo.bar`

I get a parse error from Athena.我收到来自 Athena 的解析错误。

Unfortunately, I don't have access to the Glue console to remove the table from there so I was wondering if it's possible to drop such a table via Athena SQL.不幸的是,我无法访问 Glue 控制台以从那里删除表格,所以我想知道是否可以通过 Athena SQL 删除这样的表格。 Thanks!谢谢!

Even if you don't have access to the Glue console you can use the the AWS CLI to delete the table directly using the Glue API:即使您无权访问 Glue 控制台,您也可以使用 AWS CLI 直接使用 Glue API 删除表:

aws glue delete-table --database-name dbname --name foo.bar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM