chinmay-bhat commented on code in PR #748:
URL: https://github.com/apache/iceberg-python/pull/748#discussion_r1616717556


##########
pyiceberg/table/snapshots.py:
##########
@@ -412,3 +417,12 @@ def _update_totals(total_property: str, added_property: 
str, removed_property: s
 def set_when_positive(properties: Dict[str, str], num: int, property_name: 
str) -> None:
     if num > 0:
         properties[property_name] = str(num)
+
+
+def ancestors_of(current_snapshot: Snapshot, table_metadata: TableMetadata) -> 
Iterable[Snapshot]:
+    """Get the ancestors of and including the given snapshot."""
+    if current_snapshot:
+        yield current_snapshot
+    if current_snapshot.parent_snapshot_id is not None:
+        if parent := 
table_metadata.snapshot_by_id(current_snapshot.parent_snapshot_id):
+            yield from ancestors_of(parent, table_metadata)

Review Comment:
   good catch, I missed this



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to