Skip to content

Commit 0b343a0

Browse files
committed
add test and fix
1 parent 561da0c commit 0b343a0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pyiceberg/view/metadata.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
from typing import Dict, List, Literal, Optional, Union
2020

21-
from pydantic import Field, field_validator
21+
from pydantic import Field, RootModel, field_validator
2222

2323
from pyiceberg.schema import Schema
2424
from pyiceberg.typedef import IcebergBaseModel, Identifier, Properties
@@ -36,8 +36,8 @@ class SQLViewRepresentation(IcebergBaseModel):
3636
"""The dialect of the SQL, e.g. `spark`, `trino`, `presto`."""
3737

3838

39-
class ViewRepresentation(IcebergBaseModel):
40-
__root__: SQLViewRepresentation
39+
class ViewRepresentation(IcebergBaseModel, RootModel):
40+
root: SQLViewRepresentation
4141

4242

4343
class ViewVersion(IcebergBaseModel):
@@ -55,7 +55,7 @@ class ViewVersion(IcebergBaseModel):
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: Union[str, Identifier] = Field(alias="default-namespace")
58+
default_namespace: Identifier = Field(alias="default-namespace")
5959
"""Namespace to use when a reference in the SELECT is a single identifier"""
6060

6161

tests/integration/test_writes/test_writes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1540,7 +1540,7 @@ def test_create_view(
15401540
dialect="spark",
15411541
)
15421542
],
1543-
default_namespace="default",
1543+
default_namespace=["default"],
15441544
)
15451545
session_catalog.create_view(
15461546
identifier=identifier,

0 commit comments

Comments
 (0)