kevinjqliu commented on code in PR #3347:
URL: https://github.com/apache/iceberg-python/pull/3347#discussion_r3293609952


##########
pyiceberg/catalog/rest/__init__.py:
##########
@@ -1206,19 +1183,31 @@ def drop_namespace(self, namespace: str | Identifier) 
-> None:
     def list_namespaces(self, namespace: str | Identifier = ()) -> 
list[Identifier]:
         self._check_endpoint(Capability.V1_LIST_NAMESPACES)
         namespace_tuple = self.identifier_to_tuple(namespace)
-        response = self._session.get(
-            self.url(
-                
f"{Endpoints.list_namespaces}?parent={self._encode_namespace_path(namespace_tuple)}"
-                if namespace_tuple
-                else Endpoints.list_namespaces
-            ),
+        url = (
+            
f"{Endpoints.list_namespaces}?parent={self._encode_namespace_path(namespace_tuple)}"
+            if namespace_tuple
+            else Endpoints.list_namespaces
         )
-        try:
-            response.raise_for_status()
-        except HTTPError as exc:
-            _handle_non_200_response(exc, {404: NoSuchNamespaceError})
 
-        return 
ListNamespaceResponse.model_validate_json(response.text).namespaces
+        namespaces: list[Identifier] = []
+        page_token: str | None = None
+
+        while True:
+            params = {"pageToken": page_token} if page_token else None
+            response = self._session.get(self.url(url), params=params)

Review Comment:
   ```suggestion
               params: dict[str, str] = {}
               if namespace_tuple:
                   params["parent"] = 
self._encode_namespace_path(namespace_tuple)
               if page_token:
                   params["pageToken"] = page_token
               response = 
self._session.get(self.url(Endpoints.list_namespaces), params=params)
   
   ```



##########
pyiceberg/catalog/rest/__init__.py:
##########
@@ -1206,19 +1183,31 @@ def drop_namespace(self, namespace: str | Identifier) 
-> None:
     def list_namespaces(self, namespace: str | Identifier = ()) -> 
list[Identifier]:
         self._check_endpoint(Capability.V1_LIST_NAMESPACES)
         namespace_tuple = self.identifier_to_tuple(namespace)
-        response = self._session.get(
-            self.url(
-                
f"{Endpoints.list_namespaces}?parent={self._encode_namespace_path(namespace_tuple)}"
-                if namespace_tuple
-                else Endpoints.list_namespaces
-            ),
+        url = (
+            
f"{Endpoints.list_namespaces}?parent={self._encode_namespace_path(namespace_tuple)}"
+            if namespace_tuple
+            else Endpoints.list_namespaces
         )

Review Comment:
   ```suggestion
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to