This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch 
gh-readonly-queue/main/pr-3959-d888dd113efc5bddd650ccdd17c64f8866ccf07b
in repository https://gitbox.apache.org/repos/asf/iceberg-python.git

commit dc4e3f85c8b1c356c48597f32b0246e0af9842a8
Author: Kevin Liu <[email protected]>
AuthorDate: Thu Sep 24 20:05:42 2026 +0000

    Preserve REST view response configuration (#3959)
    
    * Preserve REST view response configuration
    
    Co-authored-by: Copilot App <[email protected]>
    
    * 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 <[email protected]>
    
    ---------
    
    Co-authored-by: Copilot App <[email protected]>
---
 pyiceberg/catalog/rest/__init__.py |  1 +
 pyiceberg/view/__init__.py         |  5 ++++-
 tests/catalog/test_rest.py         |  3 +++
 tests/test_view.py                 | 13 +++++++++++++
 4 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/pyiceberg/catalog/rest/__init__.py 
b/pyiceberg/catalog/rest/__init__.py
index cb20d4ddc..88bbd29be 100644
--- a/pyiceberg/catalog/rest/__init__.py
+++ b/pyiceberg/catalog/rest/__init__.py
@@ -1186,6 +1186,7 @@ class RestCatalog(Catalog):
         return View(
             identifier=identifier_tuple,
             metadata=view_response.metadata,
+            config=view_response.config,
         )
 
     def _refresh_token(self) -> None:
diff --git a/pyiceberg/view/__init__.py b/pyiceberg/view/__init__.py
index e69b03e4e..4f298e5b6 100644
--- a/pyiceberg/view/__init__.py
+++ b/pyiceberg/view/__init__.py
@@ -20,7 +20,7 @@ from typing import Any
 from uuid import UUID
 
 from pyiceberg.schema import Schema
-from pyiceberg.typedef import Identifier
+from pyiceberg.typedef import EMPTY_DICT, Identifier
 from pyiceberg.view.metadata import SQLViewRepresentation, ViewHistoryEntry, 
ViewMetadata, ViewVersion
 
 
@@ -29,14 +29,17 @@ class View:
 
     _identifier: Identifier
     metadata: ViewMetadata
+    config: dict[str, str]
 
     def __init__(
         self,
         identifier: Identifier,
         metadata: ViewMetadata,
+        config: dict[str, str] = EMPTY_DICT,
     ) -> None:
         self._identifier = identifier
         self.metadata = metadata
+        self.config = config
 
     def name(self) -> Identifier:
         """Return the identifier of this view."""
diff --git a/tests/catalog/test_rest.py b/tests/catalog/test_rest.py
index 61b6a16e9..b06281bce 100644
--- a/tests/catalog/test_rest.py
+++ b/tests/catalog/test_rest.py
@@ -1764,6 +1764,7 @@ def test_create_view_200(rest_mock: Mocker, 
table_schema_simple: Schema, example
         metadata=ViewMetadata(**example_view_metadata_rest_json["metadata"]),
     )
     assert actual == expected
+    assert actual.config == example_view_metadata_rest_json["config"]
 
 
 def test_create_view_409(
@@ -1810,6 +1811,7 @@ def test_load_view_200(rest_mock: Mocker, 
example_view_metadata_rest_json: dict[
     actual = catalog.load_view(("fokko", "view"))
     expected = View(identifier=("fokko", "view"), 
metadata=ViewMetadata(**example_view_metadata_rest_json["metadata"]))
     assert actual == expected
+    assert actual.config == example_view_metadata_rest_json["config"]
 
 
 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
         metadata=ViewMetadata(**example_view_metadata_rest_json["metadata"]),
     )
     assert actual == expected
+    assert actual.config == example_view_metadata_rest_json["config"]
 
 
 def test_register_view_409_view(rest_mock: Mocker) -> None:
diff --git a/tests/test_view.py b/tests/test_view.py
index 00f8f24bb..5451fb56c 100644
--- a/tests/test_view.py
+++ b/tests/test_view.py
@@ -81,6 +81,19 @@ def test_view_properties(view: View) -> None:
     assert view.properties == {"comment": "this is a test view"}
 
 
+def test_view_config_defaults_to_empty(view: View) -> None:
+    assert view.config == {}
+
+
+def test_view_config(view: View) -> None:
+    config = {"token": "view-token"}
+    configured_view = View(view.name(), view.metadata, config=config)
+
+    assert configured_view.config == config
+    assert configured_view.properties == view.properties
+    assert configured_view == view
+
+
 def test_view_location(view: View) -> None:
     assert view.location() == "s3://bucket/test/location/test_view"
 

Reply via email to