How can I troubleshoot the error "FAILED: SemanticException table is not partitioned but partition spec exists" in Athena?

Lesedauer: 1 Minute
0

When I run ALTER TABLE ADD PARTITION in Amazon Athena, I get this error: "FAILED: SemanticException table is not partitioned but partition spec exists".

Resolution

This error happens if you didn't define any partitions in the CREATE TABLE statement. To resolve this error, create 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.

Or, edit the table schema in AWS Glue by doing the following:

  1. Open the AWS Glue console.
  2. Choose the table name in the list, and then choose Edit schema.
  3. Choose Add column.
  4. Enter the column name, type, and number, and then check the Partition key box.
  5. Choose Add.

For more information, see Viewing and editing table details.


AWS OFFICIAL
AWS OFFICIALAktualisiert vor 10 Monaten