Skip to content

Commit c2fc965

Browse files
committed
fix: Use keyword argument for RemoveStatisticsUpdate instantiation
Fixes #2558 When removing snapshots with statistics, RemoveStatisticsUpdate was being instantiated with a positional argument, which violates Pydantic's BaseModel requirement that all fields be passed as keyword arguments. This caused a TypeError: BaseModel.__init__() takes 1 positional argument but 2 were given when calling table.maintenance.expire_snapshots(). Changed from: RemoveStatisticsUpdate(statistics_file.snapshot_id) To: RemoveStatisticsUpdate(snapshot_id=statistics_file.snapshot_id) All existing tests pass with this fix.
1 parent bb41a6d commit c2fc965

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pyiceberg/table/update/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ def _(update: RemoveSnapshotsUpdate, base_metadata: TableMetadata, context: _Tab
528528
if ref.snapshot_id in update.snapshot_ids
529529
)
530530
remove_statistics_updates = (
531-
RemoveStatisticsUpdate(statistics_file.snapshot_id)
531+
RemoveStatisticsUpdate(snapshot_id=statistics_file.snapshot_id)
532532
for statistics_file in base_metadata.statistics
533533
if statistics_file.snapshot_id in update.snapshot_ids
534534
)

0 commit comments

Comments
 (0)