Add defaults to ViewVersion fields#3458
Open
ebyhr wants to merge 1 commit into
Open
Conversation
rambleraptor
approved these changes
Jun 5, 2026
| version_id=1, | ||
| timestamp_ms=12345, | ||
| schema_id=1, | ||
| summary={"engine-name": "spark", "engineVersion": "3.3"}, |
Collaborator
There was a problem hiding this comment.
We should keep this summary here, since it's not the default.
| version_id=1, | ||
| timestamp_ms=12345, | ||
| schema_id=1, | ||
| summary={"engine-name": "spark", "engineVersion": "3.3"}, |
Collaborator
There was a problem hiding this comment.
Keep this summary since not default.
Fokko
reviewed
Jun 6, 2026
| 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={}) |
Contributor
There was a problem hiding this comment.
I think we need to use default_factory instead:
Suggested change
| summary: dict[str, str] = Field(default={}) | |
| summary: dict[str, str] = Field(default_factory=dict) |
| 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)) |
Contributor
There was a problem hiding this comment.
I think we want to do:
Suggested change
| timestamp_ms: int = Field(alias="timestamp-ms", default=int(time.time() * 1000)) | |
| timestamp_ms: int = Field(alias="timestamp-ms", default_factory=lambda: int(time.time() * 1000)) |
Otherwise the value will be static.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
Allow users to create a view with fewer parameters.
We can set an environment context (
engine-nameandengine-version) insummaryfield by defaultonce #3441 is merged.
Are these changes tested?
Yes
Are there any user-facing changes?
No