From 19635ce7f80035db0ce71086a0f7c03ae1a3dc76 Mon Sep 17 00:00:00 2001 From: lautarortega <70765773+lautarortega@users.noreply.github.com> Date: Thu, 9 Jan 2025 11:11:06 +0100 Subject: [PATCH] bugfix/writing-complete-df Using the catalog columns only meant the new columns were being dropped. This caused the insert into statements to fail to write data for new columns. --- awswrangler/athena/_write_iceberg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awswrangler/athena/_write_iceberg.py b/awswrangler/athena/_write_iceberg.py index b85e68887..7108ac46f 100644 --- a/awswrangler/athena/_write_iceberg.py +++ b/awswrangler/athena/_write_iceberg.py @@ -546,7 +546,7 @@ def to_iceberg( # Ensure that the ordering of the DF is the same as in the catalog. # This is required for the INSERT command to work. - df = df[catalog_cols] + df = df[catalog_cols + list(schema_differences["new_columns"].keys())] if schema_evolution is False and any([schema_differences[x] for x in schema_differences]): # type: ignore[literal-required] raise exceptions.InvalidArgumentValue(f"Schema change detected: {schema_differences}")