- Newest
- Most votes
- Most comments
My understanding is you already used the correct PARTITIONED BY keyword, so I do not agree to the former answer of the re:Post Agent. I think the error "Cannot find source column" in Athena Iceberg tables is caused by case-sensitivity or syntax ordering.
- Lowercase Columns: Use lowercase for all column names (e.g.,
order_dateinstead ofOrderDate). Athena/Iceberg often fails to map partitioned columns if there is a case mismatch. - Avoid
WITHfor Partitioning: I think your second attempt failed because Iceberg in Athena does not support the partitioning property inside theWITHclause; it must use thePARTITIONED BYclause as shown above.
"To create Iceberg tables with partitions, use PARTITIONED BY syntax. Columns used for partitioning must be specified in the columns declarations first. Within the PARTITIONED BY clause, the column type must not be included. You can also define partition transforms in CREATE TABLE syntax. To specify multiple columns for partitioning, separate the columns with the comma (,) character, as in the following example." -> https://docs.aws.amazon.com/athena/latest/ug/querying-iceberg-creating-tables.html
- Hidden Partitioning: Do not add a separate column for the month. Iceberg derives the partition directly from the existing
order_datecolumn. -> https://iceberg.apache.org/docs/latest/partitioning/
The issue with your syntax is that you're using PARTITION BY instead of the correct PARTITIONED BY keyword for Iceberg tables in Athena.
Here's the corrected syntax for your first attempt:
CREATE TABLE IF NOT EXISTS database1.iceberg_table3 (
OrderID STRING,
Customer STRING,
Item STRING,
Quantity INT,
Price DOUBLE,
OrderDate TIMESTAMP,
Cancelled_Flag INT
)
PARTITIONED BY (month(OrderDate))
LOCATION 's3://my-bucket-new/output/Iceberg/'
TBLPROPERTIES (
'table_type'='ICEBERG',
'format'='PARQUET',
'write_compression'='snappy'
);
The key changes:
- Use
PARTITIONED BYinstead ofPARTITION BY - The partition transform function should be lowercase:
month(OrderDate)instead ofMONTH(OrderDate)
This syntax leverages Iceberg's hidden partitioning feature, where the partition value is derived on the fly when you write or query data, rather than being stored as a separate column. The month() transform will create monthly partitions from your timestamp column.
Your second syntax attempt using WITH clause is not the correct approach for creating Iceberg tables in Athena. Athena uses the PARTITIONED BY clause in the table definition, followed by TBLPROPERTIES to specify Iceberg-specific properties.
Sources
Create Iceberg tables - Amazon Athena
Getting started with Iceberg tables in Amazon Athena SQL - AWS Prescriptive Guidance
Relevant content
- asked a year ago
- asked 8 months ago
- AWS OFFICIALUpdated 2 years ago

Thanks Florian, it was indeed the issue with case sensitivity. On using month(orderdate) instead of MONTH(OrderDate), a partitioned table got created successfully.