HonahX commented on code in PR #748:
URL: https://github.com/apache/iceberg-python/pull/748#discussion_r1623919765
##########
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:
Sorry for late reply. Thanks for updating the PR.
+1 on removing `current_ancestors()` if we do not need it. I think we can
keep `ancestor_of()` since it will be an useful helper. We just need to make
sure there are tests for it. (Which you have already added for
`current_ancestors()`:raised_hands:).
--
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]