You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by fo...@apache.org on 2025/07/03 09:15:11 UTC
(iceberg-python) branch main updated: fix: Propagate Table properties to Glue (#2097)
This is an automated email from the ASF dual-hosted git repository.
fokko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-python.git
The following commit(s) were added to refs/heads/main by this push:
new ae11ba45 fix: Propagate Table properties to Glue (#2097)
ae11ba45 is described below
commit ae11ba45e34ebf09cfcefc24f53d3edc1d9cffc7
Author: summermousa-vendia <su...@vendia.com>
AuthorDate: Thu Jul 3 04:15:06 2025 -0500
fix: Propagate Table properties to Glue (#2097)
<!--
Thanks for opening a pull request!
-->
<!-- In the case this PR will resolve an issue, please replace
${GITHUB_ISSUE_ID} below with the actual Github issue id. -->
<!-- Closes #${GITHUB_ISSUE_ID} -->
# Rationale for this change
See https://github.com/apache/iceberg-python/pull/2013
Closes https://github.com/apache/iceberg-python/issues/2064
Continuing the trend, but with glue.
# Are these changes tested?
See test below
# Are there any user-facing changes?
When a user specifies property update on commit table, those parameters
will be passed to the glue client.
<!-- In the case of user-facing changes, please add the changelog label.
-->
---
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 88ad8aa4..4eb4164e 100644
--- a/pyiceberg/catalog/glue.py
+++ b/pyiceberg/catalog/glue.py
@@ -140,12 +140,20 @@ EXISTING_RETRY_MODES = [STANDARD_RETRY_MODE, ADAPTIVE_RETRY_MODE, LEGACY_RETRY_M
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 399c9e8b..0ff43cd5 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