HonahX commented on code in PR #947:
URL: https://github.com/apache/iceberg-python/pull/947#discussion_r1685322288


##########
pyiceberg/catalog/__init__.py:
##########
@@ -283,6 +292,20 @@ def delete_data_files(io: FileIO, manifests_to_delete: 
List[ManifestFile]) -> No
                 deleted_files[path] = True
 
 
+def _import_catalog(catalog_impl: str, properties: Properties) -> 
Optional[Catalog]:
+    try:
+        path_parts = catalog_impl.split(".")
+        if len(path_parts) < 2:
+            raise ValueError(f"py-catalog-impl should be full path 
(module.CustomCatalog), got: {catalog_impl}")
+        module_name, class_name = ".".join(path_parts[:-1]), path_parts[-1]
+        module = importlib.import_module(module_name)
+        class_ = getattr(module, class_name)
+        return class_(properties)

Review Comment:
   ```suggestion
           return class_(name, **properties)
   ```
   The `Catalog` interface has one required argument "name", and take 
properties as kwargs. We need to pass the arguments like this otherwise the 
catalog implementation cannot pick-up the properties. The name can be obtained 
from `load_catalog`



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to