kevinjqliu commented on code in PR #2890:
URL: https://github.com/apache/iceberg-python/pull/2890#discussion_r2684609165
##########
pyiceberg/table/__init__.py:
##########
@@ -1491,9 +1492,21 @@ def refs(self) -> dict[str, SnapshotRef]:
"""Return the snapshot references in the table."""
return self.metadata.refs
+ def _check_uuid(self, new_metadata: TableMetadata) -> None:
+ """Validate that the table UUID matches after refresh or commit."""
+ current = self.metadata.table_uuid
+ refreshed = new_metadata.table_uuid
+
+ if current and refreshed and current != refreshed:
+ raise ValueError(f"Table UUID does not match: current={current} !=
refreshed={refreshed}")
+
def _do_commit(self, updates: tuple[TableUpdate, ...], requirements:
tuple[TableRequirement, ...]) -> None:
response = self.catalog.commit_table(self, requirements, updates)
+ # Only check UUID for existing tables, not new tables
+ if not isinstance(self, StagedTable):
+ self._check_uuid(response.metadata)
+
Review Comment:
looks like the java implementation has this check,
https://github.com/apache/iceberg/blob/f8ee29e6eb8b5f33ea0e91fa4406a76643cb4ef6/core/src/main/java/org/apache/iceberg/rest/RESTTableOperations.java#L289-L294
guess it doesnt hurt!
more context in https://github.com/apache/iceberg/pull/14363 and
https://github.com/apache/iceberg/issues/14337
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]