Drop AWS Athena table with `.` in the name
18:09 02 Sep 2022

I had a client upload a malformed table with a name like foo.bar into an Athena instance. 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. 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.

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. Thanks!

sql amazon-web-services amazon-athena presto