Skip to content

Commit dde397b

Browse files
committed
fixup! Add defaults to ViewVersion fields
1 parent d992977 commit dde397b

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

pyiceberg/view/metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ class ViewVersion(IcebergBaseModel):
4949
"""ID for the version"""
5050
schema_id: int = Field(alias="schema-id")
5151
"""ID of the schema for the view version"""
52-
timestamp_ms: int = Field(alias="timestamp-ms", default=int(time.time() * 1000))
52+
timestamp_ms: int = Field(alias="timestamp-ms", default_factory=lambda: int(time.time() * 1000))
5353
"""Timestamp when the version was created (ms from epoch)"""
54-
summary: dict[str, str] = Field(default={})
54+
summary: dict[str, str] = Field(default_factory=dict)
5555
"""A string to string map of summary metadata about the version"""
5656
representations: list[ViewRepresentation] = Field()
5757
"""A list of representations for the view definition"""

tests/catalog/test_rest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,6 +1747,7 @@ def test_create_view_200(rest_mock: Mocker, table_schema_simple: Schema, example
17471747
schema=table_schema_simple,
17481748
view_version=ViewVersion(
17491749
schema_id=1,
1750+
summary={"engine-name": "spark", "engineVersion": "3.3"},
17501751
representations=[
17511752
{
17521753
"type": "sql",
@@ -1789,6 +1790,7 @@ def test_create_view_409(
17891790
schema=table_schema_simple,
17901791
view_version=ViewVersion(
17911792
schema_id=1,
1793+
summary={"engine-name": "spark", "engineVersion": "3.3"},
17921794
representations=[],
17931795
default_namespace=[],
17941796
),

0 commit comments

Comments
 (0)