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 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. I'd rather remove it.
   
   The `ancestors_of()` is no longer being used, but as mentioned in previous 
discussions in this PR, it is a small function that is also used in the 
cherrypick PR. I'd prefer to get it merged in this PR itself, otherwise I'll 
add it to the cherrypick one.
   
   WDYT?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to