Skip to content

wr.athena.to_iceberg not using temp_path #2978

@lautarortega

Description

@lautarortega

Describe the bug

I created an iceberg table in Athena through AWS Wrangler. I rename a column through an Athena query. When I want to write more rows to the table with the new col in the df, I get this error

QueryFailed: TYPE_MISMATCH: Insert query has mismatched column types: Table: [varchar, integer, varchar], Query: [varchar, integer, varchar, integer]. If a data manifest file was generated at 's3://aws-athena-query-results-494340620388-eu-west-1/68cb1983-852e-4f12-9d17-7af88520b02a-manifest.csv', you may need to manually clean the data from locations specified in the manifest. Athena will not delete data in your account.

The error mentioning this S3 path makes me believe it is not using the temp path I passed as an argument.

How to Reproduce

data = {'first_name': ['John'],
        'age': [52],
        'city': ['Nashville']
}


# Create a DataFrame from the dictionary
df = pd.DataFrame(data)
df

dtype = {'first_name': 'string', 'age': 'int', 'city': 'string'}
wr.athena.to_iceberg(
        df=df,
        database=DATABASE,
        table=TABLE_NAME,
        table_location=f"s3://{BUCKET}/{TABLE_NAME}",
        temp_path=f"s3://{BUCKET}/temp/{TABLE_NAME}",
        schema_evolution=True,
        keep_files=False,
        dtype=dtype,
)

Expected behavior

No response

Your project

No response

Screenshots

No response

OS

Mac

Python version

3.10

AWS SDK for pandas version

3.9.1

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions