By using AWS re:Post, you agree to the AWS re:Post Terms of Use

How do I resolve "FAILED: ParseException" errors 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:# missing EOF at '-' near 'keyword'".

Resolution

If the database name that you specify in your DDL statement contains a hyphen ("-"), then you get a ParseException error. Although AWS Glue allows database names with hyphens, Athena doesn't allow them. Underscore ("_") is the only special character that Athena supports in database, table, view, and column names.

In the following example, the database name, alb-database1, contains a hyphen. When you run the MSCK REPAIR TABLE or SHOW CREATE TABLE query, Athena returns the following 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 an underscore.

AWS OFFICIAL
AWS OFFICIALUpdated 4 months ago