How do I resolve the error "FAILED: ParseException line 1:X missing EOF at '-' near 'keyword'" in Athena?

Last updated: 2020-04-15

When I run an MSCK REPAIR TABLE or SHOW CREATE TABLE statement in Amazon Athena, I get an error like this: "FAILED: ParseException line 1:X missing EOF at '-' near 'keyword'".

Resolution

This error happens when the database name specified in the DDL statement contains a hyphen ("-"). AWS Glue allows database names with hyphens. However, underscores (_) are the only special characters that Athena supports in database, table, view, and column names.

In the following example, the database name is alb-database1. When you run MSCK REPAIR TABLE or SHOW CREATE TABLE, Athena returns a ParseException error:

Your query has the following error(s):
FAILED: ParseException line 1:7 missing EOF at '-' near 'alb'
This query ran against the "alb-database1" database, unless qualified by the query. Please post the error message on our forum or contact customer support with Query Id: cc5c1234-4c12-4dcb-a123-bff954b305eb.

To resolve this issue, recreate the database with a name that doesn't contain special characters other than underscore (_).


Did this article help you?

Anything we could improve?


Need more help?