jackye1995 commented on code in PR #947: URL: https://github.com/apache/iceberg-python/pull/947#discussion_r1685512970
########## 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: thanks, missed this when copying from `_import_file_io`, fixed. ########## tests/catalog/test_glue.py: ########## @@ -46,6 +47,23 @@ ) +@mock_aws +def test_load_catalog_from_impl() -> None: + assert isinstance( + load_catalog( + "catalog", + **{ + PY_CATALOG_IMPL: "pyiceberg.catalog.glue.GlueCatalog", Review Comment: fixed -- 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