Preserve REST view response configuration (#3959) · apache/iceberg-python@dc4e3f8 · GitHub
Skip to content

Commit dc4e3f8

Browse files
kevinjqliuCopilot
andauthored
Preserve REST view response configuration (#3959)
* Preserve REST view response configuration Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Keep view configuration prerequisite focused Remove the API documentation addition and keep the REST load test focused on preserving nonempty configuration. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent d888dd1 commit dc4e3f8

4 files changed

Lines changed: 21 additions & 1 deletion

File tree

‎pyiceberg/catalog/rest/__init__.py‎

Lines changed: 1 addition & 0 deletions

‎pyiceberg/view/__init__.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from uuid import UUID
2121

2222
from pyiceberg.schema import Schema
23-
from pyiceberg.typedef import Identifier
23+
from pyiceberg.typedef import EMPTY_DICT, Identifier
2424
from pyiceberg.view.metadata import SQLViewRepresentation, ViewHistoryEntry, ViewMetadata, ViewVersion
2525

2626

@@ -29,14 +29,17 @@ class View:
2929

3030
_identifier: Identifier
3131
metadata: ViewMetadata
32+
config: dict[str, str]
3233

3334
def __init__(
3435
self,
3536
identifier: Identifier,
3637
metadata: ViewMetadata,
38+
config: dict[str, str] = EMPTY_DICT,
3739
) -> None:
3840
self._identifier = identifier
3941
self.metadata = metadata
42+
self.config = config
4043

4144
def name(self) -> Identifier:
4245
"""Return the identifier of this view."""

‎tests/catalog/test_rest.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,6 +1764,7 @@ def test_create_view_200(rest_mock: Mocker, table_schema_simple: Schema, example
17641764
metadata=ViewMetadata(**example_view_metadata_rest_json["metadata"]),
17651765
)
17661766
assert actual == expected
1767+
assert actual.config == example_view_metadata_rest_json["config"]
17671768

17681769

17691770
def test_create_view_409(
@@ -1810,6 +1811,7 @@ def test_load_view_200(rest_mock: Mocker, example_view_metadata_rest_json: dict[
18101811
actual = catalog.load_view(("fokko", "view"))
18111812
expected = View(identifier=("fokko", "view"), metadata=ViewMetadata(**example_view_metadata_rest_json["metadata"]))
18121813
assert actual == expected
1814+
assert actual.config == example_view_metadata_rest_json["config"]
18131815

18141816

18151817
def test_load_view_404(rest_mock: Mocker) -> None:
@@ -2769,6 +2771,7 @@ def test_register_view_200(rest_mock: Mocker, example_view_metadata_rest_json: d
27692771
metadata=ViewMetadata(**example_view_metadata_rest_json["metadata"]),
27702772
)
27712773
assert actual == expected
2774+
assert actual.config == example_view_metadata_rest_json["config"]
27722775

27732776

27742777
def test_register_view_409_view(rest_mock: Mocker) -> None:

‎tests/test_view.py‎

Lines changed: 13 additions & 0 deletions

0 commit comments

Comments
 (0)