Skip to content

Commit 1b3673c

Browse files
authored
Set AssertTableUUID by default on a transaction (#804)
1 parent 94e8a98 commit 1b3673c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

pyiceberg/table/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ def commit_transaction(self) -> Table:
511511
The table with the updates applied.
512512
"""
513513
if len(self._updates) > 0:
514+
self._requirements += (AssertTableUUID(uuid=self.table_metadata.table_uuid),)
514515
self._table._do_commit( # pylint: disable=W0212
515516
updates=self._updates,
516517
requirements=self._requirements,
@@ -565,7 +566,11 @@ def commit_transaction(self) -> Table:
565566
The table with the updates applied.
566567
"""
567568
self._requirements = (AssertCreate(),)
568-
return super().commit_transaction()
569+
self._table._do_commit( # pylint: disable=W0212
570+
updates=self._updates,
571+
requirements=self._requirements,
572+
)
573+
return self._table
569574

570575

571576
class AssignUUIDUpdate(IcebergBaseModel):
@@ -2919,10 +2924,7 @@ def _commit(self) -> UpdatesAndRequirements:
29192924
snapshot_id=self._snapshot_id, parent_snapshot_id=self._parent_snapshot_id, ref_name="main", type="branch"
29202925
),
29212926
),
2922-
(
2923-
AssertTableUUID(uuid=self._transaction.table_metadata.table_uuid),
2924-
AssertRefSnapshotId(snapshot_id=self._parent_snapshot_id, ref="main"),
2925-
),
2927+
(AssertRefSnapshotId(snapshot_id=self._parent_snapshot_id, ref="main"),),
29262928
)
29272929

29282930

0 commit comments

Comments
 (0)