From 3f66d803b8ae0dec39c342fcc40600a221d63a3e Mon Sep 17 00:00:00 2001 From: Summer Mousa Date: Mon, 16 Jun 2025 12:35:50 -0500 Subject: [PATCH] fix: add metadata_properties to _construct_parameters when updating glue table --- pyiceberg/catalog/glue.py | 12 ++++++++++-- tests/catalog/test_glue.py | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pyiceberg/catalog/glue.py b/pyiceberg/catalog/glue.py index 88ad8aa433..4eb4164e57 100644 --- a/pyiceberg/catalog/glue.py +++ b/pyiceberg/catalog/glue.py @@ -140,12 +140,20 @@ def _construct_parameters( - metadata_location: str, glue_table: Optional["TableTypeDef"] = None, prev_metadata_location: Optional[str] = None + metadata_location: str, + glue_table: Optional["TableTypeDef"] = None, + prev_metadata_location: Optional[str] = None, + metadata_properties: Optional[Properties] = None, ) -> Properties: new_parameters = glue_table.get("Parameters", {}) if glue_table else {} new_parameters.update({TABLE_TYPE: ICEBERG.upper(), METADATA_LOCATION: metadata_location}) if prev_metadata_location: new_parameters[PREVIOUS_METADATA_LOCATION] = prev_metadata_location + + if metadata_properties: + for key, value in metadata_properties.items(): + new_parameters[key] = str(value) + return new_parameters @@ -236,7 +244,7 @@ def _construct_table_input( table_input: "TableInputTypeDef" = { "Name": table_name, "TableType": EXTERNAL_TABLE, - "Parameters": _construct_parameters(metadata_location, glue_table, prev_metadata_location), + "Parameters": _construct_parameters(metadata_location, glue_table, prev_metadata_location, properties), "StorageDescriptor": { "Columns": _to_columns(metadata), "Location": metadata.location, diff --git a/tests/catalog/test_glue.py b/tests/catalog/test_glue.py index 399c9e8bb1..0ff43cd52b 100644 --- a/tests/catalog/test_glue.py +++ b/tests/catalog/test_glue.py @@ -791,6 +791,8 @@ def test_commit_table_properties( Name=table_name, ) assert table_info["Table"]["Description"] == "test_description" + assert table_info["Table"]["Parameters"]["test_a"] == "test_aa" + assert table_info["Table"]["Parameters"]["test_c"] == "test_c" @mock_aws