Fokko commented on code in PR #748:
URL: https://github.com/apache/iceberg-python/pull/748#discussion_r1624051739
##########
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:
Thanks for working on this @chinmay-bhat, I also [ran into the confusion
around `current-ancestor`
myself](https://github.com/apache/iceberg/issues/6930). Thanks for adding that
to the docs itself.
--
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]