- Newest
- Most votes
- Most comments
This error typically occurs when there's a misconfiguration in how Athena is trying to access the Iceberg table location. Let's solve this step by step:
- First, ensure the S3 location is properly formatted in the table properties:
ALTER TABLE database_name.table_name SET LOCATION 's3://bucket-name/path/to/iceberg/table'
- Check if the table properties include the necessary Iceberg configurations:
ALTER TABLE database_name.table_name SET TBLPROPERTIES ( 'table_type'='ICEBERG', 'format'='parquet' )
- Verify the storage descriptor in the Glue table definition:
import boto3 glue_client = boto3.client('glue') response = glue_client.get_table( DatabaseName='your_database', Name='your_table' ) print(response['Table']['StorageDescriptor'])
- Add explicit S3 scheme to table location. You can do this using AWS CLI:
aws glue update-table --database-name your_database --table-input '{ "Name": "your_table", "StorageDescriptor": { "Location": "s3://your-bucket/path/to/table" } }'
- If the issue persists, try recreating the table using CREATE TABLE command:
CREATE TABLE database_name.new_table_name ( -- your column definitions ) LOCATION 's3://bucket-name/path/to/iceberg/table' TBLPROPERTIES ( 'table_type'='ICEBERG', 'format'='parquet' );
- Check Athena workgroup settings:
- Ensure the workgroup has access to the S3 location
- Verify the query results location is properly set
- Check if encryption settings are properly configured
- Add explicit permissions in IAM role:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetObject", "s3:ListBucket" ], "Resource": [ "arn:aws:s3:::your-bucket/*", "arn:aws:s3:::your-bucket" ] } ] }
- If you're using a custom catalog, ensure it's properly configured:
CREATE CATALOG iceberg_catalog WITH ( 'catalog.name' = 'hive', 'hive.metastore' = 'glue' );
Additional Troubleshooting:
- Verify file permissions:
aws s3 ls s3://your-bucket/path/to/iceberg/table/ --recursive
- Check for any Athena service-linked role issues:
aws iam get-role --role-name AWSServiceRoleForAthena
If none of these solutions work, you might want to:
- Check if your Iceberg table version is compatible with your Athena engine version
- Verify that all metadata files are present and accessible
- Consider recreating the table from scratch
The issue you're experiencing with Athena being unable to read your Iceberg table data despite a successful Glue crawl could be related to how the Iceberg catalog is set up in Athena. Here are some steps to troubleshoot and potentially resolve the issue:
-
Ensure you have created an Iceberg catalog in Athena. This is a crucial step that connects Athena to your Iceberg tables. You can create an Iceberg catalog using a SQL statement similar to this:
CREATE CATALOG iceberg_catalog WITH ( catalog_type = 'iceberg', warehouse_dir = 's3://your-bucket-name/', catalog_impl = 'org.apache.iceberg.aws.glue.GlueCatalog' );
Make sure to replace 'your-bucket-name' with the actual S3 bucket where your Iceberg data is stored.
-
After creating the catalog, switch to the specific database where your Iceberg tables are located.
-
Verify that you're using Athena engine version 3 or later, as earlier versions may not fully support Iceberg tables.
-
Check if the table properties in Glue include the necessary Iceberg-specific properties. You can use the DESCRIBE FORMATTED command in Athena to view the table properties.
-
Ensure that the S3 location in your table definition matches the actual location of your Iceberg data files.
-
If you're still encountering issues, you might need to recreate the table in Athena using a CREATE TABLE statement that explicitly defines it as an Iceberg table.
-
Double-check that your IAM roles have the necessary permissions not just for S3, but also for Glue and Athena operations related to Iceberg tables.
If these steps don't resolve the issue, you may need to investigate further by looking at the Iceberg metadata files in S3 to ensure they're correctly formatted and accessible. Additionally, consider checking if there are any version compatibility issues between your Iceberg data, Glue, and Athena.
Remember that Iceberg support in Athena is relatively new, so ensure you're using the latest available versions and check for any known issues or limitations in the AWS documentation.
Sources
Querying Apache Iceberg Tables in Amazon Athena | AWS re:Post
Troubleshoot Athena Apache Iceberg table errors | AWS re:Post
Relevant content
- asked 4 years ago
- asked 9 months ago
- AWS OFFICIALUpdated 2 years ago

Setting Up Your Iceberg Environment
CREATE CATALOG iceberg_catalog WITH ( catalog_type = 'iceberg', warehouse_dir = 's3://<------------>/', catalog_impl = 'org.apache.iceberg.aws.glue.GlueCatalog' );
error: line 1:8: mismatched input 'CATALOG'. Expecting: 'MATERIALIZED', 'MULTI', 'OR', 'PROTECTED', 'ROLE', 'SCHEMA', 'TABLE', 'VIEW'
geez even aws ai fails - there is no create catalog command in athena as far as I can tell