Fokko commented on code in PR #3458:
URL: https://github.com/apache/iceberg-python/pull/3458#discussion_r3366899912
##########
pyiceberg/view/metadata.py:
##########
@@ -44,13 +45,13 @@ class ViewRepresentation(IcebergBaseModel, RootModel):
class ViewVersion(IcebergBaseModel):
"""A version of the view definition."""
- version_id: int = Field(alias="version-id")
+ version_id: int = Field(alias="version-id", default=1)
"""ID for the version"""
schema_id: int = Field(alias="schema-id")
"""ID of the schema for the view version"""
- timestamp_ms: int = Field(alias="timestamp-ms")
+ timestamp_ms: int = Field(alias="timestamp-ms", default=int(time.time() *
1000))
"""Timestamp when the version was created (ms from epoch)"""
- summary: dict[str, str] = Field()
+ summary: dict[str, str] = Field(default={})
Review Comment:
I think we need to use `default_factory` instead:
```suggestion
summary: dict[str, str] = Field(default_factory=dict)
```
##########
pyiceberg/view/metadata.py:
##########
@@ -44,13 +45,13 @@ class ViewRepresentation(IcebergBaseModel, RootModel):
class ViewVersion(IcebergBaseModel):
"""A version of the view definition."""
- version_id: int = Field(alias="version-id")
+ version_id: int = Field(alias="version-id", default=1)
"""ID for the version"""
schema_id: int = Field(alias="schema-id")
"""ID of the schema for the view version"""
- timestamp_ms: int = Field(alias="timestamp-ms")
+ timestamp_ms: int = Field(alias="timestamp-ms", default=int(time.time() *
1000))
Review Comment:
I think we want to do:
```suggestion
timestamp_ms: int = Field(alias="timestamp-ms", default_factory=lambda:
int(time.time() * 1000))
```
Otherwise the value will be static.
--
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]