@@ -320,7 +320,6 @@ class ListViewsResponse(IcebergBaseModel):
320320class RestCatalog (Catalog ):
321321 uri : str
322322 _session : Session
323- _supported_endpoints : set [Endpoint ]
324323 _namespace_separator : str
325324
326325 def __init__ (self , name : str , ** properties : str ):
@@ -337,6 +336,8 @@ def __init__(self, name: str, **properties: str):
337336 self ._fetch_config ()
338337 self ._session = self ._create_session ()
339338 separator_from_properties = self .properties .get (NAMESPACE_SEPARATOR_PROPERTY , DEFAULT_NAMESPACE_SEPARATOR )
339+ if not separator_from_properties :
340+ raise ValueError ("Namespace separator cannot be an empty string" )
340341 self ._namespace_separator = unquote (separator_from_properties )
341342
342343 def _create_session (self ) -> Session :
@@ -534,8 +535,6 @@ def _identifier_to_validated_tuple(self, identifier: str | Identifier) -> Identi
534535 def _split_identifier_for_path (
535536 self , identifier : str | Identifier | TableIdentifier , kind : IdentifierKind = IdentifierKind .TABLE
536537 ) -> Properties :
537- from urllib .parse import quote
538-
539538 if isinstance (identifier , TableIdentifier ):
540539 return {
541540 "namespace" : self ._encode_namespace_path (tuple (identifier .namespace .root )),
@@ -933,7 +932,7 @@ def list_namespaces(self, namespace: str | Identifier = ()) -> list[Identifier]:
933932 namespace_tuple = self .identifier_to_tuple (namespace )
934933 response = self ._session .get (
935934 self .url (
936- f"{ Endpoints .list_namespaces } ?parent={ self ._namespace_separator . join (namespace_tuple )} "
935+ f"{ Endpoints .list_namespaces } ?parent={ self ._encode_namespace_path (namespace_tuple )} "
937936 if namespace_tuple
938937 else Endpoints .list_namespaces
939938 ),
@@ -983,14 +982,6 @@ def namespace_exists(self, namespace: str | Identifier) -> bool:
983982 namespace_tuple = self ._check_valid_namespace_identifier (namespace )
984983 namespace = self ._encode_namespace_path (namespace_tuple )
985984
986- # fallback in order to work with older rest catalog implementations
987- if Capability .V1_NAMESPACE_EXISTS not in self ._supported_endpoints :
988- try :
989- self .load_namespace_properties (namespace_tuple )
990- return True
991- except NoSuchNamespaceError :
992- return False
993-
994985 response = self ._session .head (self .url (Endpoints .namespace_exists , namespace = namespace ))
995986
996987 if response .status_code == 404 :
0 commit comments