'Trying to create a table in AWS Athena using a query

I have tried and failed many times t create a table in Athena via the create table from s3 bucket data

I have two other tables that work built by a previous colleague

Every time I try using the "Create table from s3 data I get a Json error. Every time I use a query i get the following error

mismatched input 'external'. expecting: 'or', 'schema', 'table', 'view' (service: amazonathena; status code: 400; error code: invalidrequestexception; request id: feb29e62-e93a-47cf-bccc-5c2f8a4916a1; proxy: null)


CREATE EXTERNAL TABLE IF NOT EXISTS `mytable`(
  `myfield1` string, 
  `myfield2` string, 
  `myfield3` string, 
  `myfield4` string,)
ROW FORMAT SERDE 
  'org.apache.hive.hcatalog.data.JsonSerDe' 
STORED AS INPUTFORMAT 
  'org.apache.hadoop.mapred.TextInputFormat' 
OUTPUTFORMAT 
  'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION
  's3://mybucket/myfolder/'
TBLPROPERTIES (
  'has_encrypted_data'='true',)


Solution 1:[1]

You have an extra comma in tblproperties.That might be an issue. TBLPROPERTIES ( 'has_encrypted_data'='true',) try removing that and see.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shivangi._k