1616# under the License.
1717from __future__ import annotations
1818
19- from typing import Dict , List , Literal , Optional
19+ from typing import Dict , List , Literal , Optional , Union
2020
2121from pydantic import Field , field_validator
2222
2323from pyiceberg .schema import Schema
24- from pyiceberg .typedef import IcebergBaseModel , Properties
24+ from pyiceberg .typedef import IcebergBaseModel , Identifier , Properties
2525from pyiceberg .types import transform_dict_value_to_str
2626
2727
@@ -36,10 +36,10 @@ class SQLViewRepresentation(IcebergBaseModel):
3636 """The dialect of the SQL, e.g. `spark`, `trino`, `presto`."""
3737
3838
39- class ViewRepresentation (BaseModel ):
39+ class ViewRepresentation (IcebergBaseModel ):
4040 __root__ : SQLViewRepresentation
41-
42-
41+
42+
4343class ViewVersion (IcebergBaseModel ):
4444 """A version of the view definition."""
4545
@@ -51,11 +51,11 @@ class ViewVersion(IcebergBaseModel):
5151 """Timestamp when the version was created (ms from epoch)"""
5252 summary : Dict [str , str ] = Field ()
5353 """A string to string map of summary metadata about the version"""
54- representations : List [SQLViewRepresentation ] = Field ()
54+ representations : List [ViewRepresentation ] = Field ()
5555 """A list of representations for the view definition"""
5656 default_catalog : Optional [str ] = Field (alias = "default-catalog" , default = None )
5757 """Catalog name to use when a reference in the SELECT does not contain a catalog"""
58- default_namespace : Namespace = Field (alias = "default-namespace" )
58+ default_namespace : Union [ str , Identifier ] = Field (alias = "default-namespace" )
5959 """Namespace to use when a reference in the SELECT is a single identifier"""
6060
6161
@@ -73,7 +73,7 @@ class ViewMetadata(IcebergBaseModel):
7373
7474 view_uuid : str = Field (alias = "view-uuid" )
7575 """A UUID that identifies the view, generated when the view is created."""
76- format_version : int = Field (alias = ' format-version' , ge = 1 , le = 1 )
76+ format_version : int = Field (alias = " format-version" , ge = 1 , le = 1 )
7777 """An integer version number for the view format; must be 1"""
7878 location : str = Field ()
7979 """The view's base location; used to create metadata file locations"""
@@ -83,7 +83,7 @@ class ViewMetadata(IcebergBaseModel):
8383 """ID of the current version of the view (version-id)"""
8484 versions : List [ViewVersion ] = Field ()
8585 """A list of known versions of the view"""
86- version_log : List [ViewVersionLogEntry ] = Field (alias = "version-log" )
86+ version_log : List [ViewHistoryEntry ] = Field (alias = "version-log" )
8787 """A list of version log entries"""
8888 properties : Properties = Field (default_factory = dict )
8989 """A string to string map of view properties"""
0 commit comments