How can I troubleshoot the error "FAILED: SemanticException table is not partitioned but partition spec exists" in Athena?
"When I run ALTER TABLE ADD PARTITION in Amazon Athena, I get this error: "FAILED: SemanticException table is not partitioned but partition spec exists"."
"When I run ALTER TABLE ADD PARTITION in Amazon Athena, I get this error: "FAILED: SemanticException table is not partitioned but partition spec exists".ResolutionThis error happens if you didn't define any partitions in the CREATE TABLE statement. To resolve this error, take one of the following actions:Re-create the table and use PARTIONED BY to define the partition key.Edit the table schema.Re-create the tableCreate the table again and use PARTITIONED BY to define the partition key. For an example, see Create the table. After you define the partition, you can use ALTER TABLE ADD PARTITION to add more partitions.For example, if you're using the following data definition language (DDL) to create the table with three partitions for year, month, and day:CREATE EXTERNAL TABLE test (requestBeginTime string,adId string,...)PARTITIONED BY (year string,month string,day string)ROW FORMAT serde 'org.apache.hive.hcatalog.data.JsonSerDe'LOCATION 's3://.../' ;Then, add the partitions similar to the following ones:ALTER TABLE impressions ADDPARTITION (year = '2016', month = '05', day='04') LOCATION 's3://mystorage/path/to/data\_14\_May\_2016/';Edit the table schemaTo edit the table schema in AWS Glue, complete the following steps:Open the AWS Glue console.Choose the table name in the list, and then choose Edit schema.Choose Add column.Enter the column name, type, and number. Then, check the Partition key box.Choose Add.For more information, see Viewing and editing table details.Follow"