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


##########
pyiceberg/table/__init__.py:
##########
@@ -1290,6 +1291,17 @@ def snapshot_by_name(self, name: str) -> 
Optional[Snapshot]:
             return self.snapshot_by_id(ref.snapshot_id)
         return None
 
+    def snapshot_at_or_before_timestamp(self, timestamp_ms: int) -> 
Optional[Snapshot]:
+        """Get the snapshot that was current at or right before the given 
timestamp, or None if there is no matching snapshot."""
+        for log_entry in reversed(self.history()):
+            if log_entry.timestamp_ms <= timestamp_ms:
+                return self.snapshot_by_id(log_entry.snapshot_id)
+        return None
+
+    def current_ancestors(self) -> Iterable[Snapshot]:
+        """Get a list of ancestors of and including the current snapshot."""
+        return ancestors_of(self.current_snapshot(), self.metadata)  # type: 
ignore

Review Comment:
   I've resolved the ignore error.
   
   I think we don't need `current_ancestors()` anymore. I'm not using it in 
this PR, nor do we need this as a public method, since table.history() does a 
very similar job. 
   
   The `ancestors_of()` is no longer being used, but as mentioned in previous 
discussions in this PR, it is a small function that is used in the cherrypick 
PR, once these changes are merged. 



-- 
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