skip to Main Content

I’m running the following sql in Athena to create a partition

ALTER TABLE database.table ADD 
    PARTITION (partitionone='123', partitiontwo='456') 
    LOCATION 's3://<s3-bucket>/data/partitionone=123/partitiontwo=456';

but I’m getting an error Query type not supported by Athena Iceberg at this time

I’ve tried running MSCK REPAIR TABLE as well but also getting the same error.

How do I create partitions on my Athena Iceberg table?

Iceberg Table DDL

CREATE TABLE database.table (
  id int,
  name string,
  partitionone string,
  partitiontwo string)
PARTITIONED BY (`partitionone`, `partitiontwo`)
LOCATION 's3://<s3-bucket>/data'
TBLPROPERTIES (
  'table_type'='iceberg'
);

I’ve tried creating the table without the PARTITIONED BY but still getting the same generic error returned.

2

Answers


  1. You can use Dremio to update the partitioning and the changes should then take hold in Athena.

    You can spin up a Dremio account for free and connect it your AWS Glue or S3 to run ALTER statements against those tables when needed and using Athena or Dremio for querying.

    here is the docs on ALTER TABLE: https://docs.dremio.com/cloud/reference/sql/commands/alter-table/

    { ADD | DROP } PARTITION FIELD { <column_name> | <partition_transform> } String   Optional
    
    ADD partitions the table data on the values in a single column or by using one of the partition-transformation functions. DROP drops the partition definition. These are the partition-transformation functions:
    
    identity( <col> ): Explicitly specified identity transform.
    year( <col> ): Partition by year. The column uses either the TIMESTAMP or DATE data type.
    month( <ts_col> ): Partition by month. The column uses either the TIMESTAMP or DATE data type.
    day( <ts_col> ): Partition by day. The column uses either the TIMESTAMP or DATE data type.
    hour( <ts_col> ): Partition by hour. The column uses either the TIMESTAMP or DATE data type.
    bucket( <count>, <col> ): Partition by hashed value into <count> buckets.
    truncate( <length>, <col> ): Partition by truncated value. Strings are truncated to the specified length. Integer and biginteger values are truncated to bins (for example: truncate(10, i) produces 0, 10, 20, and so on).
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search