Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion pyiceberg/table/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def snapshots(self) -> pa.Table:
"committed_at": datetime.fromtimestamp(snapshot.timestamp_ms / 1000.0, tz=timezone.utc),
"snapshot_id": snapshot.snapshot_id,
"parent_id": snapshot.parent_snapshot_id,
"operation": str(operation),
"operation": operation,
"manifest_list": snapshot.manifest_list,
"summary": additional_properties,
}
Expand Down
12 changes: 12 additions & 0 deletions tests/table/test_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,15 @@ def test_inspect_entries_and_files_render_null_bound(catalog: InMemoryCatalog) -
files_metrics = tbl.inspect.files().to_pydict()["readable_metrics"][0]["s"]
assert files_metrics["lower_bound"] is None
assert files_metrics["upper_bound"] is None


def test_inspect_snapshots_preserves_null_operation(catalog: InMemoryCatalog) -> None:
schema = Schema(NestedField(1, "s", StringType(), required=False))
tbl = catalog.create_table("default.snapshot_without_summary", schema)
tbl.append(pa.table({"s": ["value"]}, schema=pa.schema([pa.field("s", pa.large_string(), nullable=True)])))

snapshots = list(tbl.metadata.snapshots)
snapshots[0] = snapshots[0].model_copy(update={"summary": None})
tbl.metadata = tbl.metadata.model_copy(update={"snapshots": snapshots})

assert tbl.inspect.snapshots().to_pydict()["operation"] == [None]