Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use table snapshot_as_of_timestamp instead
  • Loading branch information
kevinjqliu committed Jun 19, 2024
commit 8613c2e503934fa0b59e34de15d22581c9460234
2 changes: 1 addition & 1 deletion pyiceberg/table/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3841,7 +3841,7 @@ def metadata_log_entries(self) -> "pa.Table":
])

def metadata_log_entry_to_row(metadata_entry: MetadataLogEntry) -> Dict[str, Any]:
latest_snapshot = self.tbl.metadata._snapshot_as_of_timestamp_ms(metadata_entry.timestamp_ms)
latest_snapshot = self.tbl.snapshot_as_of_timestamp(metadata_entry.timestamp_ms)
return {
"timestamp": metadata_entry.timestamp_ms,
"file": metadata_entry.metadata_file,
Expand Down
7 changes: 0 additions & 7 deletions pyiceberg/table/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,6 @@ def snapshot_by_name(self, name: str) -> Optional[Snapshot]:
return self.snapshot_by_id(ref.snapshot_id)
return None

def _snapshot_as_of_timestamp_ms(self, timestamp_ms: int) -> Optional[Snapshot]:
"""Return the snapshot that was current at the given timestamp or null if no such snapshot exists."""
for entry in reversed(self.snapshot_log):
if entry.timestamp_ms <= timestamp_ms:
return self.snapshot_by_id(entry.snapshot_id)
return None

def current_snapshot(self) -> Optional[Snapshot]:
"""Get the current snapshot for this table, or None if there is no current snapshot."""
if self.current_snapshot_id is not None:
Expand Down