QuestionAccepted answer
Amazon Athena CREATE EXTERNAL TABLE mismatched input 'external' invalidrequestexception
MrMuppet
13 Sept 2025, 21:49 UTC
124.1K views1
I am trying to create an external table in Amazon Athena. My query is the following:
CREATE EXTERNAL TABLE priceTable (
WeekDay STRING,
MonthDay INT,
price00 FLOAT,
price01 FLOAT,
price02 FLOAT,
price03 FLOAT,
price04 FLOAT,
price05 FLOAT,
price06 FLOAT,
price07 FLOAT,
price08 FLOAT,
price09 FLOAT,
price10 FLOAT,
price11 FLOAT,
price12 FLOAT,
price13 FLOAT,
price14 FLOAT,
price15 FLOAT,
price16 FLOAT,
price17 FLOAT,
price18 FLOAT,
price19 FLOAT,
price20 FLOAT,
price21 FLOAT,
price22 FLOAT,
price23 FLOAT,
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ';'
LINES TERMINATED BY '\n'
LOCATION 's3://myquicksighttestbucket/C1_SphdemDD_CANARIAS_20190501_20190531_v2'
Where the file in S3 is just a csv deliminted by semicolons. However, I get the following error:
line 1:8: mismatched input 'external'. expecting: 'or', 'schema', 'table', 'view' (service: amazonathena; status code: 400; error code: invalidrequestexception; request id: e524f7e6-39ca-4af7-9e39-f86a4d0a36c8; proxy: null)
Can anybody tell what I am doing wrong? Any help is much appreciated.
1 answer
Accepted answer · original discussion
MrMuppet
Permalink15 Sept 2025, 09:49 UTC
Oooh! I am sorry, the error was the comma after the last field!!
And, also, instead of:
FIELDS TERMINATED BY ';'
I should have used the delimiter's OCT code (073) like this:
FIELDS TERMINATED BY '073'
Your perspective belongs here.
Sign in with a verified account to contribute.
2 question comments
Use comments to ask for clarification. Post a solution as an answer.
citynormanPermalink
16 Sept 2025, 21:49 UTC
citynormanPermalink
18 Sept 2025, 09:49 UTC
It seems this is some sort of default error message for any odd error. Misplaced quotes caused the same error.