nuno-faria commented on code in PR #1363:
URL:
https://github.com/apache/datafusion-python/pull/1363#discussion_r2779599835
##########
python/datafusion/catalog.py:
##########
@@ -195,6 +243,38 @@ def kind(self) -> str:
return self._inner.kind
+class CatalogProviderList(ABC):
+ """Abstract class for defining a Python based Catalog Provider List."""
+
+ @abstractmethod
+ def catalog_names(self) -> set[str]:
+ """Set of the names of all catalogs in this catalog list."""
+ ...
+
+ @abstractmethod
+ def catalog(self, name: str) -> Catalog | None:
Review Comment:
Shouldn't the return type here be `CatalogProvider`?
##########
python/tests/test_catalog.py:
##########
@@ -93,6 +98,34 @@ def deregister_schema(self, name, cascade: bool):
del self.schemas[name]
+class CustomCatalogProviderList(dfn.catalog.CatalogProviderList):
+ def __init__(self):
+ self.catalogs = {"my_catalog": CustomCatalogProvider()}
Review Comment:
Maybe this could have an additional catalog just to show it supports
multiple ones.
##########
python/datafusion/catalog.py:
##########
@@ -195,6 +243,38 @@ def kind(self) -> str:
return self._inner.kind
+class CatalogProviderList(ABC):
+ """Abstract class for defining a Python based Catalog Provider List."""
+
+ @abstractmethod
+ def catalog_names(self) -> set[str]:
+ """Set of the names of all catalogs in this catalog list."""
+ ...
+
+ @abstractmethod
+ def catalog(self, name: str) -> Catalog | None:
+ """Retrieve a specific catalog from this catalog list."""
+ ...
+
+ def register_catalog( # noqa: B027
+ self, name: str, catalog: CatalogProviderExportable | CatalogProvider
| Catalog
Review Comment:
Also is the `Catalog` type here correct?
--
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]