vertebra-bigquery 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_bigquery-0.3.0/PKG-INFO +7 -0
- vertebra_bigquery-0.3.0/py/vertebra/_bigquery.pyi +437 -0
- vertebra_bigquery-0.3.0/py/vertebra/framework/assets/welcome.css +301 -0
- vertebra_bigquery-0.3.0/py/vertebra/framework/assets/welcome.html +146 -0
- vertebra_bigquery-0.3.0/pyproject.toml +37 -0
- vertebra_bigquery-0.3.0/rs/Cargo.lock +7673 -0
- vertebra_bigquery-0.3.0/rs/Cargo.toml +96 -0
- vertebra_bigquery-0.3.0/rs/vertebra-bigquery/Cargo.toml +43 -0
- vertebra_bigquery-0.3.0/rs/vertebra-bigquery/build.rs +8 -0
- vertebra_bigquery-0.3.0/rs/vertebra-bigquery/src/arrow_ipc.rs +416 -0
- vertebra_bigquery-0.3.0/rs/vertebra-bigquery/src/client.rs +1401 -0
- vertebra_bigquery-0.3.0/rs/vertebra-bigquery/src/codec.rs +1074 -0
- vertebra_bigquery-0.3.0/rs/vertebra-bigquery/src/cursor.rs +1301 -0
- vertebra_bigquery-0.3.0/rs/vertebra-bigquery/src/errors.rs +279 -0
- vertebra_bigquery-0.3.0/rs/vertebra-bigquery/src/lib.rs +812 -0
- vertebra_bigquery-0.3.0/rs/vertebra-bigquery/tests/bigquery_wire_tests.rs +1028 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/Cargo.toml +73 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/benches/codec.rs +101 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/benches/guards.rs +60 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/benches/ring_throughput.rs +102 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/benches/shm_transport.rs +237 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/benches/spsc.rs +261 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/bridge.rs +1650 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/broker.rs +4845 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/broker_attach.rs +1113 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/buffer.rs +203 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/channel.rs +3098 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/cleanup.rs +420 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/dbrpc/mod.rs +173 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/gcp_auth.rs +3231 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/gcp_identity.rs +733 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/guards.rs +174 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/id.rs +341 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/ipc.rs +174 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/layout.rs +32 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/lib.rs +54 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/logger.rs +449 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/notify.rs +878 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/platform/linux.rs +107 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/platform/macos.rs +92 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/platform/mod.rs +48 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/platform/windows.rs +73 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/process.rs +84 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/proto.rs +259 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/protocol/codec.rs +345 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/protocol/mod.rs +52 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/py_async.rs +1497 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/router.rs +133 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/shm.rs +2012 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/sync.rs +188 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/telemetry.rs +197 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/text.rs +1354 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/tiered_ring.rs +170 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/transport/mod.rs +2393 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/transport/ring_pair.rs +1704 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/util.rs +43 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/src/vector.rs +2117 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/tests/it/broker.rs +631 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/tests/it/gcp_auth.rs +1891 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/tests/it/main.rs +19 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/tests/it/mpmc.rs +278 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/tests/it/ring.rs +336 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/tests/it/shm.rs +661 -0
- vertebra_bigquery-0.3.0/rs/vertebra-core/tests/it/shm_streaming.rs +130 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/Cargo.toml +107 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/build.rs +11 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/src/arrow_shm.rs +526 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/src/aws_rds_root_cas.pem +2888 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/src/broker_capsule.rs +1312 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/src/connection.rs +1834 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/src/dialer.rs +1760 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/src/duckdb/mod.rs +101 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/src/gcp.rs +268 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/src/lease_guard.rs +147 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/src/lib.rs +103 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/src/mssql/mod.rs +216 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/src/oracle/mod.rs +279 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/src/oracle/tns.rs +277 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/src/postgres/mod.rs +442 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/src/py_async.rs +669 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/src/py_broker.rs +98 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/src/py_cursor.rs +241 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/src/py_errors.rs +303 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/tests/arrow_shm_stream_tests.rs +105 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/tests/broker_engine_capsule_tests.rs +198 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/tests/gcp_credentials_tests.rs +57 -0
- vertebra_bigquery-0.3.0/rs/vertebra-db/tests/postgres_vector_tests.rs +114 -0
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
"""Type stubs for the vertebra._bigquery native extension module."""
|
|
2
|
+
|
|
3
|
+
from collections.abc import Awaitable, Callable, Mapping, Sequence
|
|
4
|
+
from typing import Any, NotRequired, Self, TypedDict, final, type_check_only
|
|
5
|
+
|
|
6
|
+
from vertebra._vertebra import ArrowCursor
|
|
7
|
+
|
|
8
|
+
@type_check_only
|
|
9
|
+
class BigQueryFieldSchema(TypedDict):
|
|
10
|
+
"""BigQuery result schema field descriptor."""
|
|
11
|
+
|
|
12
|
+
name: str
|
|
13
|
+
"""Field name."""
|
|
14
|
+
type: str
|
|
15
|
+
"""BigQuery legacy or standard SQL type name."""
|
|
16
|
+
mode: str
|
|
17
|
+
"""Column mode (``NULLABLE``, ``REQUIRED``, or ``REPEATED``)."""
|
|
18
|
+
fields: NotRequired[list[BigQueryFieldSchema]]
|
|
19
|
+
"""Nested STRUCT or RECORD child field schemas."""
|
|
20
|
+
|
|
21
|
+
@type_check_only
|
|
22
|
+
class BigQueryQueryResult(TypedDict):
|
|
23
|
+
"""BigQuery synchronous or asynchronous query execution payload."""
|
|
24
|
+
|
|
25
|
+
columns: list[str]
|
|
26
|
+
"""Ordered output column names."""
|
|
27
|
+
schema: list[BigQueryFieldSchema]
|
|
28
|
+
"""Field schema metadata for output columns."""
|
|
29
|
+
rows: list[list[Any]]
|
|
30
|
+
"""Decoded tabular result rows."""
|
|
31
|
+
total_rows: int
|
|
32
|
+
"""Total rows matched by the query job."""
|
|
33
|
+
total_bytes_processed: int
|
|
34
|
+
"""Total bytes processed across queried tables and partitions."""
|
|
35
|
+
total_bytes_billed: int
|
|
36
|
+
"""Total bytes billed for query execution."""
|
|
37
|
+
slot_ms: int
|
|
38
|
+
"""Cumulative slot milliseconds consumed by the query job."""
|
|
39
|
+
cache_hit: bool
|
|
40
|
+
"""Whether results were served from BigQuery query cache."""
|
|
41
|
+
job_id: str | None
|
|
42
|
+
"""Assigned BigQuery job identifier, if created."""
|
|
43
|
+
session_id: str | None
|
|
44
|
+
"""Active BigQuery session identifier, if any."""
|
|
45
|
+
num_dml_affected_rows: int | None
|
|
46
|
+
"""Number of rows inserted, updated, or deleted by a DML statement."""
|
|
47
|
+
|
|
48
|
+
@type_check_only
|
|
49
|
+
class BigQueryDryRunResult(TypedDict):
|
|
50
|
+
"""BigQuery query dry-run cost and schema estimation payload."""
|
|
51
|
+
|
|
52
|
+
total_bytes_processed: int
|
|
53
|
+
"""Estimated bytes that execution would scan."""
|
|
54
|
+
total_bytes_billed: int
|
|
55
|
+
"""Estimated billable bytes for the query."""
|
|
56
|
+
cache_hit: bool
|
|
57
|
+
"""Whether the dry-run metadata matched a cached result."""
|
|
58
|
+
referenced_tables: list[str]
|
|
59
|
+
"""Fully-qualified table references inspected by the dry run."""
|
|
60
|
+
schema: list[BigQueryFieldSchema]
|
|
61
|
+
"""Inferred output schema for the validated query."""
|
|
62
|
+
|
|
63
|
+
@type_check_only
|
|
64
|
+
class BigQueryAppendResult(TypedDict):
|
|
65
|
+
"""BigQuery Storage Write API append confirmation payload."""
|
|
66
|
+
|
|
67
|
+
appended_rows: int
|
|
68
|
+
"""Number of rows appended to the write stream."""
|
|
69
|
+
write_stream: str
|
|
70
|
+
"""Target BigQuery Storage Write API stream resource name."""
|
|
71
|
+
|
|
72
|
+
__version__: str
|
|
73
|
+
FREE_THREADED: bool
|
|
74
|
+
GIL_USED: bool
|
|
75
|
+
|
|
76
|
+
__all__ = [
|
|
77
|
+
"FREE_THREADED",
|
|
78
|
+
"GIL_USED",
|
|
79
|
+
"AsyncBigQueryClient",
|
|
80
|
+
"AsyncBigQueryCursor",
|
|
81
|
+
"SyncBigQueryClient",
|
|
82
|
+
"SyncBigQueryCursor",
|
|
83
|
+
"__version__",
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
@final
|
|
87
|
+
class SyncBigQueryClient:
|
|
88
|
+
"""Synchronous pure-Rust Google Cloud BigQuery REST v2 and Storage Read/Write client.
|
|
89
|
+
|
|
90
|
+
``ca_pem`` applies to the REST API client; the Storage Read and Write API
|
|
91
|
+
clients use the system trust store and ignore it.
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
def __new__(
|
|
95
|
+
cls,
|
|
96
|
+
project_id: str,
|
|
97
|
+
dataset_id: str | None = None,
|
|
98
|
+
location: str | None = None,
|
|
99
|
+
rest_endpoint: str | None = None,
|
|
100
|
+
storage_endpoint: str | None = None,
|
|
101
|
+
maximum_bytes_billed: int | None = None,
|
|
102
|
+
job_timeout_ms: int | None = None,
|
|
103
|
+
priority: str | None = None,
|
|
104
|
+
labels: dict[str, str] | None = None,
|
|
105
|
+
auth_options: dict[str, str] | None = None,
|
|
106
|
+
pool_size: int = 4,
|
|
107
|
+
ca_pem: bytes | None = None,
|
|
108
|
+
) -> SyncBigQueryClient:
|
|
109
|
+
"""Initialize a synchronous BigQuery client handle."""
|
|
110
|
+
...
|
|
111
|
+
@property
|
|
112
|
+
def project_id(self) -> str:
|
|
113
|
+
"""Return the configured Google Cloud project ID."""
|
|
114
|
+
...
|
|
115
|
+
@property
|
|
116
|
+
def dataset_id(self) -> str | None:
|
|
117
|
+
"""Return the default BigQuery dataset ID, if configured."""
|
|
118
|
+
...
|
|
119
|
+
@property
|
|
120
|
+
def location(self) -> str | None:
|
|
121
|
+
"""Return the default BigQuery job location, if configured."""
|
|
122
|
+
...
|
|
123
|
+
@property
|
|
124
|
+
def rest_endpoint(self) -> str:
|
|
125
|
+
"""Return the effective BigQuery REST v2 endpoint URL."""
|
|
126
|
+
...
|
|
127
|
+
@property
|
|
128
|
+
def storage_endpoint(self) -> str:
|
|
129
|
+
"""Return the effective BigQuery Storage API gRPC endpoint URL."""
|
|
130
|
+
...
|
|
131
|
+
@property
|
|
132
|
+
def maximum_bytes_billed(self) -> int | None:
|
|
133
|
+
"""Return the per-query byte billing cap, if configured."""
|
|
134
|
+
...
|
|
135
|
+
@property
|
|
136
|
+
def job_timeout_ms(self) -> int | None:
|
|
137
|
+
"""Return the default query job timeout in milliseconds, if configured."""
|
|
138
|
+
...
|
|
139
|
+
@property
|
|
140
|
+
def priority(self) -> str | None:
|
|
141
|
+
"""Return the default query priority (`INTERACTIVE` or `BATCH`), if configured."""
|
|
142
|
+
...
|
|
143
|
+
@property
|
|
144
|
+
def pool_size(self) -> int:
|
|
145
|
+
"""Return the configured channel pool size."""
|
|
146
|
+
...
|
|
147
|
+
def query(
|
|
148
|
+
self,
|
|
149
|
+
sql: str,
|
|
150
|
+
params_json: str | None = None,
|
|
151
|
+
session_id: str | None = None,
|
|
152
|
+
create_session: bool = False,
|
|
153
|
+
destination_table: str | None = None,
|
|
154
|
+
write_disposition: str | None = None,
|
|
155
|
+
maximum_bytes_billed: int | None = None,
|
|
156
|
+
job_timeout_ms: int | None = None,
|
|
157
|
+
priority: str | None = None,
|
|
158
|
+
labels: dict[str, str] | None = None,
|
|
159
|
+
) -> BigQueryQueryResult:
|
|
160
|
+
"""Execute a GoogleSQL query via `jobs.query` and paginate through `jobs.getQueryResults`."""
|
|
161
|
+
...
|
|
162
|
+
def dry_run(
|
|
163
|
+
self,
|
|
164
|
+
sql: str,
|
|
165
|
+
params_json: str | None = None,
|
|
166
|
+
) -> BigQueryDryRunResult:
|
|
167
|
+
"""Validate `sql` via `jobs.insert(dryRun=True)` and return byte and schema estimates."""
|
|
168
|
+
...
|
|
169
|
+
def read_table_arrow(
|
|
170
|
+
self,
|
|
171
|
+
project_id: str,
|
|
172
|
+
dataset_id: str,
|
|
173
|
+
table_id: str,
|
|
174
|
+
selected_fields: Sequence[str] | None = None,
|
|
175
|
+
row_restriction: str | None = None,
|
|
176
|
+
max_streams: int = 4,
|
|
177
|
+
compression: str = "LZ4_FRAME",
|
|
178
|
+
) -> ArrowCursor:
|
|
179
|
+
"""Stream a BigQuery table via the Storage Read API into a zero-copy `ArrowCursor`."""
|
|
180
|
+
...
|
|
181
|
+
def append_arrow(
|
|
182
|
+
self,
|
|
183
|
+
parent_table: str,
|
|
184
|
+
arrow_ipc_bytes: bytes,
|
|
185
|
+
mode: str = "_default",
|
|
186
|
+
) -> BigQueryAppendResult:
|
|
187
|
+
"""Append an Arrow IPC stream to `parent_table` via the Storage Write API."""
|
|
188
|
+
...
|
|
189
|
+
def close(self) -> None:
|
|
190
|
+
"""Close the client handle."""
|
|
191
|
+
...
|
|
192
|
+
def cursor(
|
|
193
|
+
self,
|
|
194
|
+
*,
|
|
195
|
+
session_id: str | None = None,
|
|
196
|
+
destination_table: str | None = None,
|
|
197
|
+
write_disposition: str | None = None,
|
|
198
|
+
maximum_bytes_billed: int | None = None,
|
|
199
|
+
job_timeout_ms: int | None = None,
|
|
200
|
+
priority: str | None = None,
|
|
201
|
+
labels: Mapping[str, str] | None = None,
|
|
202
|
+
param_encoder: Callable[[str, Any], tuple[str, str | None]] | None = None,
|
|
203
|
+
lazy_begin: bool = False,
|
|
204
|
+
) -> SyncBigQueryCursor:
|
|
205
|
+
"""Create a synchronous PEP 249 cursor backed by this BigQuery client."""
|
|
206
|
+
...
|
|
207
|
+
|
|
208
|
+
@final
|
|
209
|
+
class SyncBigQueryCursor:
|
|
210
|
+
"""Synchronous PEP 249-shaped cursor over a native BigQuery client."""
|
|
211
|
+
|
|
212
|
+
arraysize: int
|
|
213
|
+
|
|
214
|
+
@property
|
|
215
|
+
def description(self) -> tuple[tuple[str, str, None, None, None, None, bool | None], ...] | None:
|
|
216
|
+
"""Return the column descriptions of the current result set, or `None`."""
|
|
217
|
+
...
|
|
218
|
+
@property
|
|
219
|
+
def rowcount(self) -> int:
|
|
220
|
+
"""Return the row or DML count of the last statement, or `-1`."""
|
|
221
|
+
...
|
|
222
|
+
@property
|
|
223
|
+
def lastrowid(self) -> int | None:
|
|
224
|
+
"""Return `None` (BigQuery does not report last insert rowids)."""
|
|
225
|
+
...
|
|
226
|
+
@property
|
|
227
|
+
def query_metadata(self) -> dict[str, Any] | None:
|
|
228
|
+
"""Return job metadata for the last executed query, or `None` before any."""
|
|
229
|
+
...
|
|
230
|
+
def execute(
|
|
231
|
+
self,
|
|
232
|
+
sql: str,
|
|
233
|
+
params: str | Sequence[Any] | Mapping[str, Any] | None = (),
|
|
234
|
+
) -> Self:
|
|
235
|
+
"""Run one query job and buffer its rows, description, and metadata."""
|
|
236
|
+
...
|
|
237
|
+
def executemany(
|
|
238
|
+
self,
|
|
239
|
+
sql: str,
|
|
240
|
+
seq_of_params: Sequence[str | Sequence[Any] | Mapping[str, Any]],
|
|
241
|
+
) -> Self:
|
|
242
|
+
"""Run one query job per parameter set in order and sum DML row counts."""
|
|
243
|
+
...
|
|
244
|
+
def fetchone(self) -> tuple[Any, ...] | None:
|
|
245
|
+
"""Return the next buffered row, or `None` when exhausted."""
|
|
246
|
+
...
|
|
247
|
+
def fetchmany(self, size: int | None = None) -> list[tuple[Any, ...]]:
|
|
248
|
+
"""Return up to `size` buffered rows, defaulting to `arraysize`."""
|
|
249
|
+
...
|
|
250
|
+
def fetchall(self) -> list[tuple[Any, ...]]:
|
|
251
|
+
"""Return every remaining buffered row."""
|
|
252
|
+
...
|
|
253
|
+
def close(self) -> None:
|
|
254
|
+
"""Close the cursor and drop its buffered rows."""
|
|
255
|
+
...
|
|
256
|
+
def __enter__(self) -> Self:
|
|
257
|
+
"""Enter a context manager block returning this cursor."""
|
|
258
|
+
...
|
|
259
|
+
def __exit__(
|
|
260
|
+
self,
|
|
261
|
+
exc_type: object = None,
|
|
262
|
+
exc_value: object = None,
|
|
263
|
+
traceback: object = None,
|
|
264
|
+
) -> bool:
|
|
265
|
+
"""Close the cursor on context manager exit."""
|
|
266
|
+
...
|
|
267
|
+
|
|
268
|
+
@final
|
|
269
|
+
class AsyncBigQueryClient:
|
|
270
|
+
"""Asynchronous pure-Rust Google Cloud BigQuery REST v2 and Storage Read/Write client.
|
|
271
|
+
|
|
272
|
+
``ca_pem`` applies to the REST API client; the Storage Read and Write API
|
|
273
|
+
clients use the system trust store and ignore it.
|
|
274
|
+
"""
|
|
275
|
+
|
|
276
|
+
def __new__(
|
|
277
|
+
cls,
|
|
278
|
+
project_id: str,
|
|
279
|
+
dataset_id: str | None = None,
|
|
280
|
+
location: str | None = None,
|
|
281
|
+
rest_endpoint: str | None = None,
|
|
282
|
+
storage_endpoint: str | None = None,
|
|
283
|
+
maximum_bytes_billed: int | None = None,
|
|
284
|
+
job_timeout_ms: int | None = None,
|
|
285
|
+
priority: str | None = None,
|
|
286
|
+
labels: dict[str, str] | None = None,
|
|
287
|
+
auth_options: dict[str, str] | None = None,
|
|
288
|
+
pool_size: int = 4,
|
|
289
|
+
ca_pem: bytes | None = None,
|
|
290
|
+
) -> AsyncBigQueryClient:
|
|
291
|
+
"""Initialize an asynchronous BigQuery client handle."""
|
|
292
|
+
...
|
|
293
|
+
@property
|
|
294
|
+
def project_id(self) -> str:
|
|
295
|
+
"""Return the configured Google Cloud project ID."""
|
|
296
|
+
...
|
|
297
|
+
@property
|
|
298
|
+
def dataset_id(self) -> str | None:
|
|
299
|
+
"""Return the default BigQuery dataset ID, if configured."""
|
|
300
|
+
...
|
|
301
|
+
@property
|
|
302
|
+
def location(self) -> str | None:
|
|
303
|
+
"""Return the default BigQuery job location, if configured."""
|
|
304
|
+
...
|
|
305
|
+
@property
|
|
306
|
+
def rest_endpoint(self) -> str:
|
|
307
|
+
"""Return the effective BigQuery REST v2 endpoint URL."""
|
|
308
|
+
...
|
|
309
|
+
@property
|
|
310
|
+
def storage_endpoint(self) -> str:
|
|
311
|
+
"""Return the effective BigQuery Storage API gRPC endpoint URL."""
|
|
312
|
+
...
|
|
313
|
+
@property
|
|
314
|
+
def maximum_bytes_billed(self) -> int | None:
|
|
315
|
+
"""Return the per-query byte billing cap, if configured."""
|
|
316
|
+
...
|
|
317
|
+
@property
|
|
318
|
+
def job_timeout_ms(self) -> int | None:
|
|
319
|
+
"""Return the default query job timeout in milliseconds, if configured."""
|
|
320
|
+
...
|
|
321
|
+
@property
|
|
322
|
+
def priority(self) -> str | None:
|
|
323
|
+
"""Return the default query priority (`INTERACTIVE` or `BATCH`), if configured."""
|
|
324
|
+
...
|
|
325
|
+
@property
|
|
326
|
+
def pool_size(self) -> int:
|
|
327
|
+
"""Return the configured channel pool size."""
|
|
328
|
+
...
|
|
329
|
+
def query(
|
|
330
|
+
self,
|
|
331
|
+
sql: str,
|
|
332
|
+
params_json: str | None = None,
|
|
333
|
+
session_id: str | None = None,
|
|
334
|
+
create_session: bool = False,
|
|
335
|
+
destination_table: str | None = None,
|
|
336
|
+
write_disposition: str | None = None,
|
|
337
|
+
maximum_bytes_billed: int | None = None,
|
|
338
|
+
job_timeout_ms: int | None = None,
|
|
339
|
+
priority: str | None = None,
|
|
340
|
+
labels: dict[str, str] | None = None,
|
|
341
|
+
) -> Awaitable[BigQueryQueryResult]:
|
|
342
|
+
"""Execute a GoogleSQL query asynchronously on the shared Tokio runtime."""
|
|
343
|
+
...
|
|
344
|
+
def dry_run(
|
|
345
|
+
self,
|
|
346
|
+
sql: str,
|
|
347
|
+
params_json: str | None = None,
|
|
348
|
+
) -> Awaitable[BigQueryDryRunResult]:
|
|
349
|
+
"""Validate `sql` asynchronously via `jobs.insert(dryRun=True)`."""
|
|
350
|
+
...
|
|
351
|
+
def read_table_arrow(
|
|
352
|
+
self,
|
|
353
|
+
project_id: str,
|
|
354
|
+
dataset_id: str,
|
|
355
|
+
table_id: str,
|
|
356
|
+
selected_fields: Sequence[str] | None = None,
|
|
357
|
+
row_restriction: str | None = None,
|
|
358
|
+
max_streams: int = 4,
|
|
359
|
+
compression: str = "LZ4_FRAME",
|
|
360
|
+
) -> Awaitable[ArrowCursor]:
|
|
361
|
+
"""Stream a BigQuery table asynchronously into a zero-copy `ArrowCursor`."""
|
|
362
|
+
...
|
|
363
|
+
def append_arrow(
|
|
364
|
+
self,
|
|
365
|
+
parent_table: str,
|
|
366
|
+
arrow_ipc_bytes: bytes,
|
|
367
|
+
mode: str = "_default",
|
|
368
|
+
) -> Awaitable[BigQueryAppendResult]:
|
|
369
|
+
"""Append an Arrow IPC stream asynchronously via the Storage Write API."""
|
|
370
|
+
...
|
|
371
|
+
def close(self) -> None:
|
|
372
|
+
"""Close the client handle."""
|
|
373
|
+
...
|
|
374
|
+
def cursor(
|
|
375
|
+
self,
|
|
376
|
+
*,
|
|
377
|
+
session_id: str | None = None,
|
|
378
|
+
destination_table: str | None = None,
|
|
379
|
+
write_disposition: str | None = None,
|
|
380
|
+
maximum_bytes_billed: int | None = None,
|
|
381
|
+
job_timeout_ms: int | None = None,
|
|
382
|
+
priority: str | None = None,
|
|
383
|
+
labels: Mapping[str, str] | None = None,
|
|
384
|
+
param_encoder: Callable[[str, Any], tuple[str, str | None]] | None = None,
|
|
385
|
+
lazy_begin: bool = False,
|
|
386
|
+
) -> AsyncBigQueryCursor:
|
|
387
|
+
"""Create an asynchronous PEP 249 cursor backed by this BigQuery client."""
|
|
388
|
+
...
|
|
389
|
+
|
|
390
|
+
@final
|
|
391
|
+
class AsyncBigQueryCursor:
|
|
392
|
+
"""Asynchronous PEP 249-shaped cursor over a native BigQuery client."""
|
|
393
|
+
|
|
394
|
+
arraysize: int
|
|
395
|
+
|
|
396
|
+
@property
|
|
397
|
+
def description(self) -> tuple[tuple[str, str, None, None, None, None, bool | None], ...] | None:
|
|
398
|
+
"""Return the column descriptions of the current result set, or `None`."""
|
|
399
|
+
...
|
|
400
|
+
@property
|
|
401
|
+
def rowcount(self) -> int:
|
|
402
|
+
"""Return the row or DML count of the last statement, or `-1`."""
|
|
403
|
+
...
|
|
404
|
+
@property
|
|
405
|
+
def lastrowid(self) -> int | None:
|
|
406
|
+
"""Return `None` (BigQuery does not report last insert rowids)."""
|
|
407
|
+
...
|
|
408
|
+
@property
|
|
409
|
+
def query_metadata(self) -> dict[str, Any] | None:
|
|
410
|
+
"""Return job metadata for the last executed query, or `None` before any."""
|
|
411
|
+
...
|
|
412
|
+
def execute(
|
|
413
|
+
self,
|
|
414
|
+
sql: str,
|
|
415
|
+
params: str | Sequence[Any] | Mapping[str, Any] | None = (),
|
|
416
|
+
) -> Awaitable[Self]:
|
|
417
|
+
"""Run one query job asynchronously and buffer its rows, description, and metadata."""
|
|
418
|
+
...
|
|
419
|
+
def executemany(
|
|
420
|
+
self,
|
|
421
|
+
sql: str,
|
|
422
|
+
seq_of_params: Sequence[str | Sequence[Any] | Mapping[str, Any]],
|
|
423
|
+
) -> Awaitable[Self]:
|
|
424
|
+
"""Run one query job per parameter set in order asynchronously and sum DML row counts."""
|
|
425
|
+
...
|
|
426
|
+
def fetchone(self) -> Awaitable[tuple[Any, ...] | None]:
|
|
427
|
+
"""Return the next buffered row, or `None` when exhausted."""
|
|
428
|
+
...
|
|
429
|
+
def fetchmany(self, size: int | None = None) -> Awaitable[list[tuple[Any, ...]]]:
|
|
430
|
+
"""Return up to `size` buffered rows, defaulting to `arraysize`."""
|
|
431
|
+
...
|
|
432
|
+
def fetchall(self) -> Awaitable[list[tuple[Any, ...]]]:
|
|
433
|
+
"""Return every remaining buffered row."""
|
|
434
|
+
...
|
|
435
|
+
def close(self) -> Awaitable[None]:
|
|
436
|
+
"""Close the cursor and drop its buffered rows."""
|
|
437
|
+
...
|