Skip to content
Advertisement

Amazon Athena returning “mismatched input ‘partitioned’ expecting {, ‘with’}” error when creating partitions

I’d like to use this query to create a partitioned table in Amazon Athena:

CREATE TABLE IF NOT EXISTS 
 testing.partitioned_test(order_id bigint, name string, car string, country string)
 PARTITIONED BY (year int)
 ROW FORMAT SERDE 'parquet.hive.serde.ParquetHiveSerDe'
 STORED AS 'PARQUET'
 LOCATION 's3://testing-imcm-into/partitions'

Unfortunately I don’t get the error message which tells me the following:

line 3:2: mismatched input ‘partitioned’ expecting {, ‘with’}

Advertisement

Answer

The quotes around 'PARQUET' seemed to be causing a problem.

Try this:

CREATE EXTERNAL TABLE IF NOT EXISTS 
partitioned_test (order_id bigint, name string, car string, country string)
PARTITIONED BY (year int)
STORED AS PARQUET
LOCATION 's3://testing-imcm-into/partitions/'
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement