|
88 | 88 |
|
89 | 89 |
|
90 | 90 | from pyiceberg.table.metadata import Snapshot, TableMetadata |
91 | | -from pyiceberg.table.snapshots import Snapshot |
92 | 91 |
|
93 | 92 |
|
94 | 93 | def _new_manifest_file_name(num: int, commit_uuid: uuid.UUID) -> str: |
@@ -244,7 +243,7 @@ def _summary(self, snapshot_properties: Dict[str, str] = EMPTY_DICT) -> Summary: |
244 | 243 | previous_summary=previous_snapshot.summary if previous_snapshot is not None else None, |
245 | 244 | ) |
246 | 245 |
|
247 | | - def _commit(self, base_metadata: TableMetadata) -> UpdatesAndRequirements: |
| 246 | + def _commit(self) -> UpdatesAndRequirements: |
248 | 247 | new_manifests = self._manifests() |
249 | 248 | next_sequence_number = self._transaction.table_metadata.next_sequence_number() |
250 | 249 |
|
@@ -750,6 +749,7 @@ class ManageSnapshots(UpdateTableMetadata["ManageSnapshots"]): |
750 | 749 | _requirements: Tuple[TableRequirement, ...] = () |
751 | 750 |
|
752 | 751 | def _commit(self) -> UpdatesAndRequirements: |
| 752 | + """Apply the pending changes and commit.""" |
753 | 753 | return self._updates, self._requirements |
754 | 754 |
|
755 | 755 | def _remove_ref_snapshot(self, ref_name: str) -> ManageSnapshots: |
@@ -852,7 +852,7 @@ def remove_branch(self, branch_name: str) -> ManageSnapshots: |
852 | 852 |
|
853 | 853 | class ExpireSnapshots(UpdateTableMetadata["ExpireSnapshots"]): |
854 | 854 | """ |
855 | | - Expire snapshots by ID or by timestamp. |
| 855 | + Expire snapshots by ID. |
856 | 856 | Use table.expire_snapshots().<operation>().commit() to run a specific operation. |
857 | 857 | Use table.expire_snapshots().<operation-one>().<operation-two>().commit() to run multiple operations. |
858 | 858 | Pending changes are applied on commit. |
@@ -889,24 +889,3 @@ def expire_snapshot_by_id(self, snapshot_id: int) -> ExpireSnapshots: |
889 | 889 | raise ValueError(f"Snapshot with ID {snapshot_id} does not exist.") |
890 | 890 | self._snapshot_ids_to_expire.add(snapshot_id) |
891 | 891 | return self |
892 | | - |
893 | | - def expire_snapshots_older_than(self, timestamp_ms: int) -> ExpireSnapshots: |
894 | | - """ |
895 | | - Expire snapshots older than the given timestamp. |
896 | | -
|
897 | | - Args: |
898 | | - timestamp_ms (int): The timestamp in milliseconds. Snapshots older than this will be expired. |
899 | | -
|
900 | | - Returns: |
901 | | - This for method chaining. |
902 | | - """ |
903 | | - # Collect IDs of snapshots to be expired |
904 | | - snapshots_to_remove = [ |
905 | | - snapshot.snapshot_id |
906 | | - for snapshot in self._transaction.table_metadata.snapshots |
907 | | - if snapshot.timestamp_ms < timestamp_ms |
908 | | - ] |
909 | | - if snapshots_to_remove: |
910 | | - for snapshot_id in snapshots_to_remove: |
911 | | - self._snapshot_ids_to_expire.add(snapshot_id) |
912 | | - return self |
0 commit comments