Skip to content

Commit 47e9e6b

Browse files
authored
fix(python/adbc_driver_manager): update type annotations (apache#3603)
1 parent ec49580 commit 47e9e6b

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

python/adbc_driver_manager/adbc_driver_manager/_lib.pyi

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717

1818
# NOTE: generated with mypy's stubgen, then hand-edited to fix things
1919

20-
import typing_extensions
21-
from typing import Any, ClassVar, List, Literal, Optional, Tuple, Union
22-
23-
from typing import overload
2420
import enum
2521
import pathlib
2622
import typing
23+
from typing import overload, Any, ClassVar, List, Literal, Optional, Tuple, Union
24+
25+
import typing_extensions
26+
from typing_extensions import CapsuleType
2727

2828
INGEST_OPTION_MODE: str
2929
INGEST_OPTION_MODE_APPEND: str
@@ -150,11 +150,16 @@ class ArrowArrayStreamHandle:
150150
address: int
151151
is_valid: bool
152152
def release(self) -> None: ...
153+
def __arrow_c_schema__(self) -> CapsuleType: ...
154+
def __arrow_c_stream__(
155+
self, requested_schema=Optional[CapsuleType]
156+
) -> CapsuleType: ...
153157

154158
class ArrowSchemaHandle:
155159
address: int
156160
is_valid: bool
157161
def release(self) -> None: ...
162+
def __arrow_c_schema__(self) -> CapsuleType: ...
158163

159164
class DataError(DatabaseError): ...
160165
class DatabaseError(Error): ...

python/adbc_driver_manager/tests/test_dbapi_polars_nopyarrow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def test_query(sqlite: dbapi.Connection) -> None:
8383
with sqlite.cursor() as cursor:
8484
cursor.execute("SELECT 1 AS theresult")
8585
capsule = cursor.fetch_arrow()
86-
df = typing.cast(polars.DataFrame, polars.from_arrow(capsule))
86+
df = polars.from_arrow(capsule)
8787
polars.testing.assert_frame_equal(
8888
df,
8989
polars.DataFrame(

0 commit comments

Comments
 (0)