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

1 minute read
0

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

Resolution

You get this error 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 any special characters other than underscore (_).


Related information

Names for tables, databases, and columns

AWS OFFICIAL
AWS OFFICIALUpdated 2 years ago