I'm creating an Iceberg table in Athena like this:
CREATE TABLE IF NOT EXISTS table1 (`col1` string, `col2` string)
LOCATION 's3://my-bucket/path/table1/'
TBLPROPERTIES ('table_type'='ICEBERG', 'format'='parquet')
and then trying to insert values into that table, like this:
INSERT INTO table1 VALUES ('hello', 'iceberg')
I'm encountering an error like this:
GENERIC_INTERNAL_ERROR:
io.trino.hdfs.s3.TrinoS3FileSystem$UnrecoverableS3OperationException:
com.amazonaws.services.s3.model.AmazonS3Exception:
The specified key does not exist. (Service: Amazon S3; Status Code: 404; Error Code: NoSuchKey; Request ...
What am I doing wrong?
The location is being set incorrectly, and should not include a trailing /
.
Verify this by checking aws s3 ls s3://my-bucket/path/table1/ --recursive
. If you see a key with //
, such as s3://my-bucket/path/table1//metadata/...
, you have encountered this problem. The //
is a helpful indication that you've included an extra /
.
Simply create the table without the trailing /
in the location.
CREATE TABLE IF NOT EXISTS table1 (`col1` string, `col2` string)
LOCATION 's3://my-bucket/path/table1'
TBLPROPERTIES ('table_type'='ICEBERG', 'format'='parquet')