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
7 changes: 4 additions & 3 deletions pyiceberg/view/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# under the License.
from __future__ import annotations

import time
from typing import Literal

from pydantic import Field, RootModel, field_validator
Expand Down Expand Up @@ -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))
Comment thread
ebyhr marked this conversation as resolved.
Outdated
"""Timestamp when the version was created (ms from epoch)"""
summary: dict[str, str] = Field()
summary: dict[str, str] = Field(default={})
Comment thread
ebyhr marked this conversation as resolved.
Outdated
"""A string to string map of summary metadata about the version"""
representations: list[ViewRepresentation] = Field()
"""A list of representations for the view definition"""
Expand Down
6 changes: 0 additions & 6 deletions tests/catalog/test_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1746,10 +1746,7 @@ def test_create_view_200(rest_mock: Mocker, table_schema_simple: Schema, example
identifier=("fokko", "fokko2"),
schema=table_schema_simple,
view_version=ViewVersion(
version_id=1,
timestamp_ms=12345,
schema_id=1,
summary={"engine-name": "spark", "engineVersion": "3.3"},
Comment thread
ebyhr marked this conversation as resolved.
representations=[
{
"type": "sql",
Expand Down Expand Up @@ -1791,10 +1788,7 @@ def test_create_view_409(
identifier=("fokko", "fokko2"),
schema=table_schema_simple,
view_version=ViewVersion(
version_id=1,
timestamp_ms=12345,
schema_id=1,
summary={"engine-name": "spark", "engineVersion": "3.3"},
Comment thread
ebyhr marked this conversation as resolved.
representations=[],
default_namespace=[],
),
Expand Down
3 changes: 0 additions & 3 deletions tests/integration/test_writes/test_writes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1769,10 +1769,7 @@ def test_create_view(
identifier = "default.some_view"
schema = pa.schema([pa.field("some_col", pa.int32())])
view_version = ViewVersion(
version_id=1,
schema_id=1,
timestamp_ms=int(time.time() * 1000),
summary={},
representations=[
SQLViewRepresentation(
type="sql",
Expand Down