Skip to content

Commit 9b31690

Browse files
committed
Set parent_snapshot_id to None
1 parent 818f771 commit 9b31690

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pyiceberg/table/update/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,11 @@ def _(update: RemoveSnapshotsUpdate, base_metadata: TableMetadata, context: _Tab
463463
if not any(s.snapshot_id == remove_snapshot_id for s in base_metadata.snapshots):
464464
raise ValueError(f"Snapshot with snapshot id {remove_snapshot_id} does not exist: {base_metadata.snapshots}")
465465

466-
snapshots = [s for s in base_metadata.snapshots if s.snapshot_id not in update.snapshot_ids]
466+
snapshots = [
467+
(s.model_copy(update={"parent_snapshot_id": None}) if s.parent_snapshot_id in update.snapshot_ids else s)
468+
for s in base_metadata.snapshots
469+
if s.snapshot_id not in update.snapshot_ids
470+
]
467471
context.add_update(update)
468472
return base_metadata.model_copy(update={"snapshots": snapshots})
469473

0 commit comments

Comments
 (0)