-
Notifications
You must be signed in to change notification settings - Fork 144
feat: add CatalogProviderList support #1363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
nuno-faria
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
python/datafusion/catalog.py
Outdated
| ... | ||
|
|
||
| @abstractmethod | ||
| def catalog(self, name: str) -> Catalog | None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the return type here be CatalogProvider?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! This should be any of the 3 returnable types, including Catalog.
| ... | ||
|
|
||
| def register_catalog( # noqa: B027 | ||
| self, name: str, catalog: CatalogProviderExportable | CatalogProvider | Catalog |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also is the Catalog type here correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, especially if they want to register an in-memory catalog they created with the static method.
|
|
||
| class CustomCatalogProviderList(dfn.catalog.CatalogProviderList): | ||
| def __init__(self): | ||
| self.catalogs = {"my_catalog": CustomCatalogProvider()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this could have an additional catalog just to show it supports multiple ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a different catalog type in the register test to follow.
|
Thanks for the review @nuno-faria ! |
Which issue does this PR close?
Follow on to #1156
Rationale for this change
We currently support the following kinds of providers: Catalog, Schema, and Table. There is one more in the heirarchy, CatalogProviderList. This adds the missing support.
What changes are included in this PR?
Following the same patterns as in CatalogProvider (and others) this adds support for Python and Rust based CatalogProviderList. It adds the option to register a new provider list with the session context.
Are there any user-facing changes?
New addition only.