vertebra-duckdb 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vertebra_duckdb-0.3.0/PKG-INFO +7 -0
- vertebra_duckdb-0.3.0/py/vertebra/_duckdb.pyi +441 -0
- vertebra_duckdb-0.3.0/py/vertebra/framework/assets/welcome.css +301 -0
- vertebra_duckdb-0.3.0/py/vertebra/framework/assets/welcome.html +146 -0
- vertebra_duckdb-0.3.0/pyproject.toml +37 -0
- vertebra_duckdb-0.3.0/rs/Cargo.lock +7673 -0
- vertebra_duckdb-0.3.0/rs/Cargo.toml +96 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/Cargo.toml +73 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/benches/codec.rs +101 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/benches/guards.rs +60 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/benches/ring_throughput.rs +102 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/benches/shm_transport.rs +237 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/benches/spsc.rs +261 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/bridge.rs +1650 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/broker.rs +4845 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/broker_attach.rs +1113 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/buffer.rs +203 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/channel.rs +3098 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/cleanup.rs +420 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/dbrpc/mod.rs +173 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/gcp_auth.rs +3231 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/gcp_identity.rs +733 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/guards.rs +174 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/id.rs +341 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/ipc.rs +174 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/layout.rs +32 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/lib.rs +54 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/logger.rs +449 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/notify.rs +878 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/platform/linux.rs +107 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/platform/macos.rs +92 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/platform/mod.rs +48 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/platform/windows.rs +73 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/process.rs +84 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/proto.rs +259 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/protocol/codec.rs +345 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/protocol/mod.rs +52 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/py_async.rs +1497 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/router.rs +133 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/shm.rs +2012 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/sync.rs +188 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/telemetry.rs +197 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/text.rs +1354 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/tiered_ring.rs +170 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/transport/mod.rs +2393 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/transport/ring_pair.rs +1704 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/util.rs +43 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/src/vector.rs +2117 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/tests/it/broker.rs +631 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/tests/it/gcp_auth.rs +1891 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/tests/it/main.rs +19 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/tests/it/mpmc.rs +278 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/tests/it/ring.rs +336 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/tests/it/shm.rs +661 -0
- vertebra_duckdb-0.3.0/rs/vertebra-core/tests/it/shm_streaming.rs +130 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/Cargo.toml +107 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/build.rs +11 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/src/arrow_shm.rs +526 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/src/aws_rds_root_cas.pem +2888 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/src/broker_capsule.rs +1312 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/src/connection.rs +1834 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/src/dialer.rs +1760 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/src/duckdb/mod.rs +101 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/src/gcp.rs +268 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/src/lease_guard.rs +147 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/src/lib.rs +103 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/src/mssql/mod.rs +216 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/src/oracle/mod.rs +279 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/src/oracle/tns.rs +277 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/src/postgres/mod.rs +442 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/src/py_async.rs +669 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/src/py_broker.rs +98 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/src/py_cursor.rs +241 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/src/py_errors.rs +303 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/tests/arrow_shm_stream_tests.rs +105 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/tests/broker_engine_capsule_tests.rs +198 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/tests/gcp_credentials_tests.rs +57 -0
- vertebra_duckdb-0.3.0/rs/vertebra-db/tests/postgres_vector_tests.rs +114 -0
- vertebra_duckdb-0.3.0/rs/vertebra-duckdb/Cargo.toml +35 -0
- vertebra_duckdb-0.3.0/rs/vertebra-duckdb/build.rs +9 -0
- vertebra_duckdb-0.3.0/rs/vertebra-duckdb/src/cursor.rs +714 -0
- vertebra_duckdb-0.3.0/rs/vertebra-duckdb/src/errors.rs +278 -0
- vertebra_duckdb-0.3.0/rs/vertebra-duckdb/src/lib.rs +4402 -0
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
"""Type stubs for the vertebra._duckdb native extension module."""
|
|
2
|
+
|
|
3
|
+
from collections.abc import Awaitable, Mapping, Sequence
|
|
4
|
+
from typing import Any, final
|
|
5
|
+
|
|
6
|
+
from vertebra._vertebra import ArrowCursor
|
|
7
|
+
|
|
8
|
+
__version__: str
|
|
9
|
+
FREE_THREADED: bool
|
|
10
|
+
GIL_USED: bool
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"FREE_THREADED",
|
|
14
|
+
"GIL_USED",
|
|
15
|
+
"AsyncDuckDBClient",
|
|
16
|
+
"AsyncDuckDBCursor",
|
|
17
|
+
"SyncDuckDBClient",
|
|
18
|
+
"SyncDuckDBCursor",
|
|
19
|
+
"__version__",
|
|
20
|
+
"broker_engine_capsule",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
def broker_engine_capsule() -> object: ...
|
|
24
|
+
|
|
25
|
+
@final
|
|
26
|
+
class SyncDuckDBClient:
|
|
27
|
+
"""Synchronous native DuckDB 2.0 client bridged via SyncCompletionQueue."""
|
|
28
|
+
|
|
29
|
+
def __new__(
|
|
30
|
+
cls,
|
|
31
|
+
database: str = ":memory:",
|
|
32
|
+
*,
|
|
33
|
+
read_only: bool = False,
|
|
34
|
+
max_connections: int = 4,
|
|
35
|
+
max_memory_bytes: int | None = None,
|
|
36
|
+
threads: int | None = None,
|
|
37
|
+
temp_directory: str | None = None,
|
|
38
|
+
parquet_metadata_cache: bool = True,
|
|
39
|
+
httpfs_connection_caching: bool = True,
|
|
40
|
+
enable_http_metadata_cache: bool = True,
|
|
41
|
+
config: Mapping[str, str] | None = None,
|
|
42
|
+
extensions: Sequence[str] | None = None,
|
|
43
|
+
init_statements: Sequence[str] | None = None,
|
|
44
|
+
) -> SyncDuckDBClient:
|
|
45
|
+
"""Initialize a synchronous DuckDB worker pool handle."""
|
|
46
|
+
...
|
|
47
|
+
@property
|
|
48
|
+
def database(self) -> str:
|
|
49
|
+
"""Return the resolved DuckDB database path or `:memory:`."""
|
|
50
|
+
...
|
|
51
|
+
@property
|
|
52
|
+
def read_only(self) -> bool:
|
|
53
|
+
"""Return whether the worker pool was opened in read-only mode."""
|
|
54
|
+
...
|
|
55
|
+
@property
|
|
56
|
+
def max_connections(self) -> int:
|
|
57
|
+
"""Return the configured number of pooled DuckDB worker connections."""
|
|
58
|
+
...
|
|
59
|
+
@property
|
|
60
|
+
def is_in_memory(self) -> bool:
|
|
61
|
+
"""Return whether the client targets an in-memory DuckDB catalog."""
|
|
62
|
+
...
|
|
63
|
+
@property
|
|
64
|
+
def in_transaction(self) -> bool:
|
|
65
|
+
"""Return whether an explicit transaction is active on the writer session."""
|
|
66
|
+
...
|
|
67
|
+
@property
|
|
68
|
+
def closed(self) -> bool:
|
|
69
|
+
"""Return whether the worker pool has been closed."""
|
|
70
|
+
...
|
|
71
|
+
@property
|
|
72
|
+
def bootstrap_statements(self) -> list[str]:
|
|
73
|
+
"""Return the session bootstrap `SET` statements applied to pooled workers."""
|
|
74
|
+
...
|
|
75
|
+
def execute(
|
|
76
|
+
self,
|
|
77
|
+
sql: str,
|
|
78
|
+
parameters: Sequence[Any] | Mapping[str, Any] | None = None,
|
|
79
|
+
) -> int:
|
|
80
|
+
"""Execute a DDL or DML statement and return the affected row count."""
|
|
81
|
+
...
|
|
82
|
+
def execute_many(
|
|
83
|
+
self,
|
|
84
|
+
sql: str,
|
|
85
|
+
parameter_sets: Sequence[Sequence[Any] | Mapping[str, Any]],
|
|
86
|
+
) -> int:
|
|
87
|
+
"""Execute a statement across multiple parameter sets and return total affected rows."""
|
|
88
|
+
...
|
|
89
|
+
def select_to_arrow(
|
|
90
|
+
self,
|
|
91
|
+
sql: str,
|
|
92
|
+
parameters: Sequence[Any] | Mapping[str, Any] | None = None,
|
|
93
|
+
*,
|
|
94
|
+
batch_size: int = 65536,
|
|
95
|
+
threshold_rows: int = 0,
|
|
96
|
+
) -> ArrowCursor:
|
|
97
|
+
"""Stream analytical query results into an `ArrowCursor`."""
|
|
98
|
+
...
|
|
99
|
+
def stream_arrow_batches(
|
|
100
|
+
self,
|
|
101
|
+
sql: str,
|
|
102
|
+
parameters: Sequence[Any] | Mapping[str, Any] | None = None,
|
|
103
|
+
*,
|
|
104
|
+
batch_size: int = 65536,
|
|
105
|
+
) -> list[ArrowCursor]:
|
|
106
|
+
"""Stream Arrow record batches as shared-memory `ArrowCursor` frames."""
|
|
107
|
+
...
|
|
108
|
+
def load_from_arrow(
|
|
109
|
+
self,
|
|
110
|
+
table: str,
|
|
111
|
+
source: Any,
|
|
112
|
+
*,
|
|
113
|
+
columns: Sequence[str] | None = None,
|
|
114
|
+
create_if_missing: bool = True,
|
|
115
|
+
) -> int:
|
|
116
|
+
"""Bulk-ingest an Arrow IPC buffer, `ArrowCursor`, PyArrow table, or row sequence via `Appender`."""
|
|
117
|
+
...
|
|
118
|
+
def begin(self) -> None:
|
|
119
|
+
"""Begin an explicit transaction on the writer worker."""
|
|
120
|
+
...
|
|
121
|
+
def commit(self) -> None:
|
|
122
|
+
"""Commit the active transaction on the writer worker."""
|
|
123
|
+
...
|
|
124
|
+
def rollback(self) -> None:
|
|
125
|
+
"""Roll back the active transaction on the writer worker."""
|
|
126
|
+
...
|
|
127
|
+
def savepoint(self, name: str) -> None:
|
|
128
|
+
"""Record a transactional savepoint on the active transaction."""
|
|
129
|
+
...
|
|
130
|
+
def rollback_to_savepoint(self, name: str) -> None:
|
|
131
|
+
"""Roll back the active transaction to savepoint `name`."""
|
|
132
|
+
...
|
|
133
|
+
def release_savepoint(self, name: str) -> None:
|
|
134
|
+
"""Release savepoint `name` on the active transaction."""
|
|
135
|
+
...
|
|
136
|
+
def interrupt(self) -> None:
|
|
137
|
+
"""Interrupt any in-flight DuckDB query across pooled workers."""
|
|
138
|
+
...
|
|
139
|
+
def cancel(self) -> None:
|
|
140
|
+
"""Interrupt any in-flight DuckDB query across pooled workers."""
|
|
141
|
+
...
|
|
142
|
+
def close(self) -> None:
|
|
143
|
+
"""Shut down all pooled DuckDB worker threads."""
|
|
144
|
+
...
|
|
145
|
+
def to_async(self) -> AsyncDuckDBClient:
|
|
146
|
+
"""Return an `AsyncDuckDBClient` sharing the same worker pool."""
|
|
147
|
+
...
|
|
148
|
+
def cursor(self, *, lazy_begin: bool = False) -> SyncDuckDBCursor:
|
|
149
|
+
"""Return a PEP 249 cursor sharing the underlying worker pool."""
|
|
150
|
+
...
|
|
151
|
+
def fetch_rows(
|
|
152
|
+
self,
|
|
153
|
+
sql: str,
|
|
154
|
+
params: Sequence[Any] | Mapping[str, Any] | None = (),
|
|
155
|
+
) -> tuple[list[tuple[Any, ...]], tuple[str, ...]]:
|
|
156
|
+
"""Run one statement and return its rows and column names."""
|
|
157
|
+
...
|
|
158
|
+
def fetch_dicts(
|
|
159
|
+
self,
|
|
160
|
+
sql: str,
|
|
161
|
+
params: Sequence[Any] | Mapping[str, Any] | None = (),
|
|
162
|
+
) -> list[dict[str, Any]]:
|
|
163
|
+
"""Run one statement and return each row as a dictionary keyed by column name."""
|
|
164
|
+
...
|
|
165
|
+
def fetch_value(
|
|
166
|
+
self,
|
|
167
|
+
sql: str,
|
|
168
|
+
params: Sequence[Any] | Mapping[str, Any] | None = (),
|
|
169
|
+
) -> Any:
|
|
170
|
+
"""Run one statement and return the first column of the first row."""
|
|
171
|
+
...
|
|
172
|
+
def execute_dml(
|
|
173
|
+
self,
|
|
174
|
+
sql: str,
|
|
175
|
+
params: Sequence[Any] | Mapping[str, Any] | None = (),
|
|
176
|
+
) -> tuple[int, int | None]:
|
|
177
|
+
"""Run one statement and return the changed-row count and `None`."""
|
|
178
|
+
...
|
|
179
|
+
def __repr__(self) -> str: ...
|
|
180
|
+
def __enter__(self) -> SyncDuckDBClient: ...
|
|
181
|
+
def __exit__(
|
|
182
|
+
self,
|
|
183
|
+
_exc_type: Any = None,
|
|
184
|
+
_exc_val: Any = None,
|
|
185
|
+
_exc_tb: Any = None,
|
|
186
|
+
) -> None: ...
|
|
187
|
+
|
|
188
|
+
@final
|
|
189
|
+
class SyncDuckDBCursor:
|
|
190
|
+
"""Synchronous PEP 249 cursor over a native DuckDB worker pool."""
|
|
191
|
+
|
|
192
|
+
arraysize: int
|
|
193
|
+
|
|
194
|
+
@property
|
|
195
|
+
def description(self) -> tuple[tuple[str, None, None, None, None, None, None], ...] | None:
|
|
196
|
+
"""Return the column descriptions of the current result set, or `None`."""
|
|
197
|
+
...
|
|
198
|
+
|
|
199
|
+
@property
|
|
200
|
+
def rowcount(self) -> int:
|
|
201
|
+
"""Return the changed-row count of the last statement, or `-1`."""
|
|
202
|
+
...
|
|
203
|
+
|
|
204
|
+
@property
|
|
205
|
+
def lastrowid(self) -> int | None:
|
|
206
|
+
"""Return `None`; DuckDB reports no inserted rowid."""
|
|
207
|
+
...
|
|
208
|
+
|
|
209
|
+
def execute(self, sql: str, params: Sequence[Any] | Mapping[str, Any] | None = ()) -> SyncDuckDBCursor:
|
|
210
|
+
"""Run one statement and buffer its result on this cursor."""
|
|
211
|
+
...
|
|
212
|
+
|
|
213
|
+
def executemany(self, sql: str, seq_of_params: Sequence[Sequence[Any] | Mapping[str, Any]]) -> SyncDuckDBCursor:
|
|
214
|
+
"""Run one statement once per parameter set."""
|
|
215
|
+
...
|
|
216
|
+
|
|
217
|
+
def fetchone(self) -> tuple[Any, ...] | None:
|
|
218
|
+
"""Return the next buffered row, or `None` when the result set is exhausted."""
|
|
219
|
+
...
|
|
220
|
+
|
|
221
|
+
def fetchmany(self, size: int | None = None) -> list[tuple[Any, ...]]:
|
|
222
|
+
"""Return up to `size` buffered rows, defaulting to `arraysize`."""
|
|
223
|
+
...
|
|
224
|
+
|
|
225
|
+
def fetchall(self) -> list[tuple[Any, ...]]:
|
|
226
|
+
"""Return every remaining buffered row."""
|
|
227
|
+
...
|
|
228
|
+
|
|
229
|
+
def close(self) -> None:
|
|
230
|
+
"""Close the cursor and drop its buffered rows."""
|
|
231
|
+
...
|
|
232
|
+
|
|
233
|
+
@final
|
|
234
|
+
class AsyncDuckDBClient:
|
|
235
|
+
"""Asynchronous native DuckDB 2.0 client bridged via AsyncCompletionQueue and Notifier."""
|
|
236
|
+
|
|
237
|
+
def __new__(
|
|
238
|
+
cls,
|
|
239
|
+
database: str = ":memory:",
|
|
240
|
+
*,
|
|
241
|
+
read_only: bool = False,
|
|
242
|
+
max_connections: int = 4,
|
|
243
|
+
max_memory_bytes: int | None = None,
|
|
244
|
+
threads: int | None = None,
|
|
245
|
+
temp_directory: str | None = None,
|
|
246
|
+
parquet_metadata_cache: bool = True,
|
|
247
|
+
httpfs_connection_caching: bool = True,
|
|
248
|
+
enable_http_metadata_cache: bool = True,
|
|
249
|
+
config: Mapping[str, str] | None = None,
|
|
250
|
+
extensions: Sequence[str] | None = None,
|
|
251
|
+
init_statements: Sequence[str] | None = None,
|
|
252
|
+
) -> AsyncDuckDBClient:
|
|
253
|
+
"""Initialize an asynchronous DuckDB worker pool handle."""
|
|
254
|
+
...
|
|
255
|
+
@property
|
|
256
|
+
def database(self) -> str:
|
|
257
|
+
"""Return the resolved DuckDB database path or `:memory:`."""
|
|
258
|
+
...
|
|
259
|
+
@property
|
|
260
|
+
def read_only(self) -> bool:
|
|
261
|
+
"""Return whether the worker pool was opened in read-only mode."""
|
|
262
|
+
...
|
|
263
|
+
@property
|
|
264
|
+
def max_connections(self) -> int:
|
|
265
|
+
"""Return the configured number of pooled DuckDB worker connections."""
|
|
266
|
+
...
|
|
267
|
+
@property
|
|
268
|
+
def is_in_memory(self) -> bool:
|
|
269
|
+
"""Return whether the client targets an in-memory DuckDB catalog."""
|
|
270
|
+
...
|
|
271
|
+
@property
|
|
272
|
+
def in_transaction(self) -> bool:
|
|
273
|
+
"""Return whether an explicit transaction is active on the writer session."""
|
|
274
|
+
...
|
|
275
|
+
@property
|
|
276
|
+
def closed(self) -> bool:
|
|
277
|
+
"""Return whether the worker pool has been closed."""
|
|
278
|
+
...
|
|
279
|
+
@property
|
|
280
|
+
def bootstrap_statements(self) -> list[str]:
|
|
281
|
+
"""Return the session bootstrap `SET` statements applied to pooled workers."""
|
|
282
|
+
...
|
|
283
|
+
def execute(
|
|
284
|
+
self,
|
|
285
|
+
sql: str,
|
|
286
|
+
parameters: Sequence[Any] | Mapping[str, Any] | None = None,
|
|
287
|
+
) -> Awaitable[int]:
|
|
288
|
+
"""Execute a DDL or DML statement asynchronously and return the affected row count."""
|
|
289
|
+
...
|
|
290
|
+
def execute_many(
|
|
291
|
+
self,
|
|
292
|
+
sql: str,
|
|
293
|
+
parameter_sets: Sequence[Sequence[Any] | Mapping[str, Any]],
|
|
294
|
+
) -> Awaitable[int]:
|
|
295
|
+
"""Execute a statement across multiple parameter sets asynchronously."""
|
|
296
|
+
...
|
|
297
|
+
def select_to_arrow(
|
|
298
|
+
self,
|
|
299
|
+
sql: str,
|
|
300
|
+
parameters: Sequence[Any] | Mapping[str, Any] | None = None,
|
|
301
|
+
*,
|
|
302
|
+
batch_size: int = 65536,
|
|
303
|
+
threshold_rows: int = 0,
|
|
304
|
+
) -> Awaitable[ArrowCursor]:
|
|
305
|
+
"""Stream analytical query results asynchronously into an `ArrowCursor`."""
|
|
306
|
+
...
|
|
307
|
+
def stream_arrow_batches(
|
|
308
|
+
self,
|
|
309
|
+
sql: str,
|
|
310
|
+
parameters: Sequence[Any] | Mapping[str, Any] | None = None,
|
|
311
|
+
*,
|
|
312
|
+
batch_size: int = 65536,
|
|
313
|
+
) -> Awaitable[list[ArrowCursor]]:
|
|
314
|
+
"""Stream Arrow record batches asynchronously as shared-memory `ArrowCursor` frames."""
|
|
315
|
+
...
|
|
316
|
+
def load_from_arrow(
|
|
317
|
+
self,
|
|
318
|
+
table: str,
|
|
319
|
+
source: Any,
|
|
320
|
+
*,
|
|
321
|
+
columns: Sequence[str] | None = None,
|
|
322
|
+
create_if_missing: bool = True,
|
|
323
|
+
) -> Awaitable[int]:
|
|
324
|
+
"""Bulk-ingest an Arrow IPC buffer, `ArrowCursor`, PyArrow table, or row sequence asynchronously."""
|
|
325
|
+
...
|
|
326
|
+
def begin(self) -> Awaitable[None]:
|
|
327
|
+
"""Begin an explicit transaction asynchronously."""
|
|
328
|
+
...
|
|
329
|
+
def commit(self) -> Awaitable[None]:
|
|
330
|
+
"""Commit the active transaction asynchronously."""
|
|
331
|
+
...
|
|
332
|
+
def rollback(self) -> Awaitable[None]:
|
|
333
|
+
"""Roll back the active transaction asynchronously."""
|
|
334
|
+
...
|
|
335
|
+
def savepoint(self, name: str) -> Awaitable[None]:
|
|
336
|
+
"""Record a transactional savepoint asynchronously."""
|
|
337
|
+
...
|
|
338
|
+
def rollback_to_savepoint(self, name: str) -> Awaitable[None]:
|
|
339
|
+
"""Roll back the active transaction asynchronously to savepoint `name`."""
|
|
340
|
+
...
|
|
341
|
+
def release_savepoint(self, name: str) -> Awaitable[None]:
|
|
342
|
+
"""Release savepoint `name` asynchronously."""
|
|
343
|
+
...
|
|
344
|
+
def interrupt(self) -> None:
|
|
345
|
+
"""Interrupt any in-flight DuckDB query across pooled workers."""
|
|
346
|
+
...
|
|
347
|
+
def cancel(self) -> None:
|
|
348
|
+
"""Interrupt any in-flight DuckDB query across pooled workers."""
|
|
349
|
+
...
|
|
350
|
+
def close(self) -> Awaitable[None]:
|
|
351
|
+
"""Shut down all pooled DuckDB worker threads asynchronously."""
|
|
352
|
+
...
|
|
353
|
+
def to_sync(self) -> SyncDuckDBClient:
|
|
354
|
+
"""Return a `SyncDuckDBClient` sharing the same worker pool."""
|
|
355
|
+
...
|
|
356
|
+
def cursor(self, *, lazy_begin: bool = False) -> AsyncDuckDBCursor:
|
|
357
|
+
"""Return an awaitable PEP 249-shaped cursor sharing the underlying worker pool."""
|
|
358
|
+
...
|
|
359
|
+
def fetch_rows(
|
|
360
|
+
self,
|
|
361
|
+
sql: str,
|
|
362
|
+
params: Sequence[Any] | Mapping[str, Any] | None = (),
|
|
363
|
+
) -> Awaitable[tuple[list[tuple[Any, ...]], tuple[str, ...]]]:
|
|
364
|
+
"""Run one statement asynchronously and return the rows alongside their column names."""
|
|
365
|
+
...
|
|
366
|
+
def fetch_dicts(
|
|
367
|
+
self,
|
|
368
|
+
sql: str,
|
|
369
|
+
params: Sequence[Any] | Mapping[str, Any] | None = (),
|
|
370
|
+
) -> Awaitable[list[dict[str, Any]]]:
|
|
371
|
+
"""Run one statement asynchronously and return each row as a dictionary keyed by column name."""
|
|
372
|
+
...
|
|
373
|
+
def fetch_value(
|
|
374
|
+
self,
|
|
375
|
+
sql: str,
|
|
376
|
+
params: Sequence[Any] | Mapping[str, Any] | None = (),
|
|
377
|
+
) -> Awaitable[Any]:
|
|
378
|
+
"""Run one statement asynchronously and return the first column of the first row."""
|
|
379
|
+
...
|
|
380
|
+
def execute_dml(
|
|
381
|
+
self,
|
|
382
|
+
sql: str,
|
|
383
|
+
params: Sequence[Any] | Mapping[str, Any] | None = (),
|
|
384
|
+
) -> Awaitable[tuple[int, int | None]]:
|
|
385
|
+
"""Run one statement asynchronously and return the changed-row count and `None`."""
|
|
386
|
+
...
|
|
387
|
+
def __repr__(self) -> str: ...
|
|
388
|
+
def __aenter__(self) -> Awaitable[AsyncDuckDBClient]: ...
|
|
389
|
+
def __aexit__(
|
|
390
|
+
self,
|
|
391
|
+
_exc_type: Any = None,
|
|
392
|
+
_exc_val: Any = None,
|
|
393
|
+
_exc_tb: Any = None,
|
|
394
|
+
) -> Awaitable[None]: ...
|
|
395
|
+
|
|
396
|
+
@final
|
|
397
|
+
class AsyncDuckDBCursor:
|
|
398
|
+
"""Awaitable PEP 249-shaped cursor over a native DuckDB worker pool."""
|
|
399
|
+
|
|
400
|
+
arraysize: int
|
|
401
|
+
|
|
402
|
+
@property
|
|
403
|
+
def description(self) -> tuple[tuple[str, None, None, None, None, None, None], ...] | None:
|
|
404
|
+
"""Return the column descriptions of the current result set, or `None`."""
|
|
405
|
+
...
|
|
406
|
+
|
|
407
|
+
@property
|
|
408
|
+
def rowcount(self) -> int:
|
|
409
|
+
"""Return the changed-row count of the last statement, or `-1`."""
|
|
410
|
+
...
|
|
411
|
+
|
|
412
|
+
@property
|
|
413
|
+
def lastrowid(self) -> int | None:
|
|
414
|
+
"""Return `None`; DuckDB reports no inserted rowid."""
|
|
415
|
+
...
|
|
416
|
+
|
|
417
|
+
def execute(self, sql: str, params: Sequence[Any] | Mapping[str, Any] | None = ()) -> Awaitable[AsyncDuckDBCursor]:
|
|
418
|
+
"""Run one statement and buffer its result on this cursor."""
|
|
419
|
+
...
|
|
420
|
+
|
|
421
|
+
def executemany(
|
|
422
|
+
self, sql: str, seq_of_params: Sequence[Sequence[Any] | Mapping[str, Any]]
|
|
423
|
+
) -> Awaitable[AsyncDuckDBCursor]:
|
|
424
|
+
"""Run one statement once per parameter set."""
|
|
425
|
+
...
|
|
426
|
+
|
|
427
|
+
def fetchone(self) -> Awaitable[tuple[Any, ...] | None]:
|
|
428
|
+
"""Return the next buffered row, or `None` when the result set is exhausted."""
|
|
429
|
+
...
|
|
430
|
+
|
|
431
|
+
def fetchmany(self, size: int | None = None) -> Awaitable[list[tuple[Any, ...]]]:
|
|
432
|
+
"""Return up to `size` buffered rows, defaulting to `arraysize`."""
|
|
433
|
+
...
|
|
434
|
+
|
|
435
|
+
def fetchall(self) -> Awaitable[list[tuple[Any, ...]]]:
|
|
436
|
+
"""Return every remaining buffered row."""
|
|
437
|
+
...
|
|
438
|
+
|
|
439
|
+
def close(self) -> Awaitable[None]:
|
|
440
|
+
"""Close the cursor and drop its buffered rows."""
|
|
441
|
+
...
|