当我在 Amazon Athena 中运行 MSCK REPAIR TABLE 或 SHOW CREATE TABLE 语句时,出现类似于以下内容的错误: “FAILED: ParseException line 1:# missing EOF at '-' near 'keyword'”。
解决方法
如果您在 DDL 语句中指定的数据库名称包含连字符(“-”),则会出现 ParseException 错误。尽管 AWS Glue 允许使用连字符的数据库名称,但 Athena 不允许使用连字符。下划线(“\ _”)是 Athena 在数据库、表、视图和列名称中支持的唯一特殊字符。
在以下示例中,数据库名称 alb-database1 包含连字符。当您运行 MSCK REPAIR TABLE 或 SHOW CREATE TABLE 查询时,Athena 会返回以下 ParseException 错误:
“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.”
要解决此问题,请使用除下划线之外不包含任何特殊字符的名称重新创建数据库。