1414# KIND, either express or implied. See the License for the
1515# specific language governing permissions and limitations
1616# under the License.
17+ from typing import Optional
18+
1719from pyiceberg .manifest import ManifestContent , ManifestFile
1820from pyiceberg .table import Table
1921from pyiceberg .table .snapshots import Operation , Snapshot , ancestors_between
@@ -25,17 +27,17 @@ class ValidationException(Exception):
2527
2628def validation_history (
2729 table : Table ,
28- starting_snapshot : Snapshot ,
29- parent_snapshot : Snapshot ,
30+ from_snapshot : Snapshot ,
31+ to_snapshot : Optional [ Snapshot ] ,
3032 matching_operations : set [Operation ],
3133 manifest_content_filter : ManifestContent ,
3234) -> tuple [list [ManifestFile ], set [Snapshot ]]:
3335 """Return newly added manifests and snapshot IDs between the starting snapshot and parent snapshot.
3436
3537 Args:
3638 table: Table to get the history from
37- starting_snapshot: Starting snapshot
38- parent_snapshot: Parent snapshot to get the history from
39+ from_snapshot: Parent snapshot to get the history from
40+ to_snapshot: Starting snapshot
3941 matching_operations: Operations to match on
4042 manifest_content_filter: Manifest content type to filter
4143
@@ -49,7 +51,7 @@ def validation_history(
4951 snapshots : set [Snapshot ] = set ()
5052
5153 last_snapshot = None
52- for snapshot in ancestors_between (starting_snapshot , parent_snapshot , table .metadata ):
54+ for snapshot in ancestors_between (from_snapshot , to_snapshot , table .metadata ):
5355 last_snapshot = snapshot
5456 summary = snapshot .summary
5557 if summary is None :
@@ -64,7 +66,7 @@ def validation_history(
6466 ]
6567 )
6668
67- if last_snapshot is None or last_snapshot .snapshot_id == starting_snapshot .snapshot_id :
69+ if last_snapshot is None or last_snapshot .snapshot_id == from_snapshot .snapshot_id :
6870 raise ValidationException ("No matching snapshot found." )
6971
7072 return manifests_files , snapshots
0 commit comments