Skip to content
Open
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
Prev Previous commit
PR comments
  • Loading branch information
rambleraptor committed Dec 15, 2025
commit 20cea63ebd3fd31399189eebf7c4e349db72bf97
6 changes: 3 additions & 3 deletions pyiceberg/catalog/rest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ def __init__(self, name: str, **properties: str):
self._fetch_config()
self._session = self._create_session()
separator_from_properties = self.properties.get(NAMESPACE_SEPARATOR_PROPERTY, DEFAULT_NAMESPACE_SEPARATOR)
if not separator_from_properties:
raise ValueError("Namespace separator cannot be an empty string")
self._namespace_separator = unquote(separator_from_properties)

def _create_session(self) -> Session:
Expand Down Expand Up @@ -396,8 +398,6 @@ def _identifier_to_validated_tuple(self, identifier: str | Identifier) -> Identi
def _split_identifier_for_path(
self, identifier: str | Identifier | TableIdentifier, kind: IdentifierKind = IdentifierKind.TABLE
) -> Properties:
from urllib.parse import quote

if isinstance(identifier, TableIdentifier):
return {
"namespace": self._encode_namespace_path(tuple(identifier.namespace.root)),
Expand Down Expand Up @@ -783,7 +783,7 @@ def list_namespaces(self, namespace: str | Identifier = ()) -> list[Identifier]:
namespace_tuple = self.identifier_to_tuple(namespace)
response = self._session.get(
self.url(
f"{Endpoints.list_namespaces}?parent={self._namespace_separator.join(namespace_tuple)}"
f"{Endpoints.list_namespaces}?parent={self._encode_namespace_path(namespace_tuple)}"
if namespace_tuple
else Endpoints.list_namespaces
),
Expand Down
4 changes: 1 addition & 3 deletions tests/catalog/test_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1899,8 +1899,6 @@ def test_rest_catalog_with_google_credentials_path(
actual_headers = history[0].headers
assert actual_headers["Authorization"] == expected_auth_header

assert actual_headers["Authorization"] == expected_auth_header


def test_custom_namespace_separator(rest_mock: Mocker) -> None:
custom_separator = "-"
Expand All @@ -1917,7 +1915,7 @@ def test_custom_namespace_separator(rest_mock: Mocker) -> None:
rest_mock.get(
f"{TEST_URI}v1/namespaces/{expected_url_path_segment}",
json={"namespace": [namespace_part1, namespace_part2], "properties": {"prop": "yes"}},
status_code=204,
status_code=200,
request_headers=TEST_HEADERS,
)

Expand Down