@@ -216,7 +216,6 @@ class ListViewsResponse(IcebergBaseModel):
216216class RestCatalog (Catalog ):
217217 uri : str
218218 _session : Session
219- _supported_endpoints : set [Endpoint ]
220219 _namespace_separator : str
221220
222221 def __init__ (self , name : str , ** properties : str ):
@@ -233,6 +232,8 @@ def __init__(self, name: str, **properties: str):
233232 self ._fetch_config ()
234233 self ._session = self ._create_session ()
235234 separator_from_properties = self .properties .get (NAMESPACE_SEPARATOR_PROPERTY , DEFAULT_NAMESPACE_SEPARATOR )
235+ if not separator_from_properties :
236+ raise ValueError ("Namespace separator cannot be an empty string" )
236237 self ._namespace_separator = unquote (separator_from_properties )
237238
238239 def _create_session (self ) -> Session :
@@ -397,8 +398,6 @@ def _identifier_to_validated_tuple(self, identifier: str | Identifier) -> Identi
397398 def _split_identifier_for_path (
398399 self , identifier : str | Identifier | TableIdentifier , kind : IdentifierKind = IdentifierKind .TABLE
399400 ) -> Properties :
400- from urllib .parse import quote
401-
402401 if isinstance (identifier , TableIdentifier ):
403402 return {
404403 "namespace" : self ._encode_namespace_path (tuple (identifier .namespace .root )),
@@ -784,7 +783,7 @@ def list_namespaces(self, namespace: str | Identifier = ()) -> list[Identifier]:
784783 namespace_tuple = self .identifier_to_tuple (namespace )
785784 response = self ._session .get (
786785 self .url (
787- f"{ Endpoints .list_namespaces } ?parent={ self ._namespace_separator . join (namespace_tuple )} "
786+ f"{ Endpoints .list_namespaces } ?parent={ self ._encode_namespace_path (namespace_tuple )} "
788787 if namespace_tuple
789788 else Endpoints .list_namespaces
790789 ),
@@ -832,14 +831,6 @@ def namespace_exists(self, namespace: str | Identifier) -> bool:
832831 namespace_tuple = self ._check_valid_namespace_identifier (namespace )
833832 namespace = self ._encode_namespace_path (namespace_tuple )
834833
835- # fallback in order to work with older rest catalog implementations
836- if Capability .V1_NAMESPACE_EXISTS not in self ._supported_endpoints :
837- try :
838- self .load_namespace_properties (namespace_tuple )
839- return True
840- except NoSuchNamespaceError :
841- return False
842-
843834 response = self ._session .head (self .url (Endpoints .namespace_exists , namespace = namespace ))
844835
845836 if response .status_code == 404 :
0 commit comments