-
Notifications
You must be signed in to change notification settings - Fork 163
feat(python/adbc_driver_manager): Implement import_schema for Polars DBAPI backend
#3556
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -145,16 +145,21 @@ class ArrowArrayHandle: | |
| address: int | ||
| is_valid: bool | ||
| def release(self) -> None: ... | ||
| def __arrow_c_array__( | ||
| self, requested_schema: object | None | ||
| ) -> tuple[object, object]: ... | ||
|
|
||
| class ArrowArrayStreamHandle: | ||
| address: int | ||
| is_valid: bool | ||
| def release(self) -> None: ... | ||
| def __arrow_c_stream__(self, requested_schema: object | None) -> object: ... | ||
|
|
||
| class ArrowSchemaHandle: | ||
| address: int | ||
| is_valid: bool | ||
| def release(self) -> None: ... | ||
| def __arrow_c_schema__(self) -> object: ... | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes the type checker not complain about |
||
|
|
||
| class DataError(DatabaseError): ... | ||
| class DatabaseError(Error): ... | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I think this works but would be inconvenient for people (I'm guessing this will require type assertions all over the place). But I'm not sure of a better way to do this for now. (IIRC associated types are unsupported? Else we could template Cursor on the backend type and make the return type dependent on the backend type's associated type.)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I agree it will be inconvenient. FWIW, I think the user manually type hinting the variable assignment works too.
I will give something a crack |
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.
Alternatively, could not do the version check and just
return polars.Schema(handle)immediately.Would raise with the below before the required version. IMO providing the user a nicer error message is preferable though.