vertebra-spanner 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.
Files changed (88) hide show
  1. vertebra_spanner-0.3.0/PKG-INFO +7 -0
  2. vertebra_spanner-0.3.0/py/vertebra/_spanner.pyi +577 -0
  3. vertebra_spanner-0.3.0/py/vertebra/framework/assets/welcome.css +301 -0
  4. vertebra_spanner-0.3.0/py/vertebra/framework/assets/welcome.html +146 -0
  5. vertebra_spanner-0.3.0/pyproject.toml +37 -0
  6. vertebra_spanner-0.3.0/rs/Cargo.lock +7673 -0
  7. vertebra_spanner-0.3.0/rs/Cargo.toml +96 -0
  8. vertebra_spanner-0.3.0/rs/vertebra-core/Cargo.toml +73 -0
  9. vertebra_spanner-0.3.0/rs/vertebra-core/benches/codec.rs +101 -0
  10. vertebra_spanner-0.3.0/rs/vertebra-core/benches/guards.rs +60 -0
  11. vertebra_spanner-0.3.0/rs/vertebra-core/benches/ring_throughput.rs +102 -0
  12. vertebra_spanner-0.3.0/rs/vertebra-core/benches/shm_transport.rs +237 -0
  13. vertebra_spanner-0.3.0/rs/vertebra-core/benches/spsc.rs +261 -0
  14. vertebra_spanner-0.3.0/rs/vertebra-core/src/bridge.rs +1650 -0
  15. vertebra_spanner-0.3.0/rs/vertebra-core/src/broker.rs +4845 -0
  16. vertebra_spanner-0.3.0/rs/vertebra-core/src/broker_attach.rs +1113 -0
  17. vertebra_spanner-0.3.0/rs/vertebra-core/src/buffer.rs +203 -0
  18. vertebra_spanner-0.3.0/rs/vertebra-core/src/channel.rs +3098 -0
  19. vertebra_spanner-0.3.0/rs/vertebra-core/src/cleanup.rs +420 -0
  20. vertebra_spanner-0.3.0/rs/vertebra-core/src/dbrpc/mod.rs +173 -0
  21. vertebra_spanner-0.3.0/rs/vertebra-core/src/gcp_auth.rs +3231 -0
  22. vertebra_spanner-0.3.0/rs/vertebra-core/src/gcp_identity.rs +733 -0
  23. vertebra_spanner-0.3.0/rs/vertebra-core/src/guards.rs +174 -0
  24. vertebra_spanner-0.3.0/rs/vertebra-core/src/id.rs +341 -0
  25. vertebra_spanner-0.3.0/rs/vertebra-core/src/ipc.rs +174 -0
  26. vertebra_spanner-0.3.0/rs/vertebra-core/src/layout.rs +32 -0
  27. vertebra_spanner-0.3.0/rs/vertebra-core/src/lib.rs +54 -0
  28. vertebra_spanner-0.3.0/rs/vertebra-core/src/logger.rs +449 -0
  29. vertebra_spanner-0.3.0/rs/vertebra-core/src/notify.rs +878 -0
  30. vertebra_spanner-0.3.0/rs/vertebra-core/src/platform/linux.rs +107 -0
  31. vertebra_spanner-0.3.0/rs/vertebra-core/src/platform/macos.rs +92 -0
  32. vertebra_spanner-0.3.0/rs/vertebra-core/src/platform/mod.rs +48 -0
  33. vertebra_spanner-0.3.0/rs/vertebra-core/src/platform/windows.rs +73 -0
  34. vertebra_spanner-0.3.0/rs/vertebra-core/src/process.rs +84 -0
  35. vertebra_spanner-0.3.0/rs/vertebra-core/src/proto.rs +259 -0
  36. vertebra_spanner-0.3.0/rs/vertebra-core/src/protocol/codec.rs +345 -0
  37. vertebra_spanner-0.3.0/rs/vertebra-core/src/protocol/mod.rs +52 -0
  38. vertebra_spanner-0.3.0/rs/vertebra-core/src/py_async.rs +1497 -0
  39. vertebra_spanner-0.3.0/rs/vertebra-core/src/router.rs +133 -0
  40. vertebra_spanner-0.3.0/rs/vertebra-core/src/shm.rs +2012 -0
  41. vertebra_spanner-0.3.0/rs/vertebra-core/src/sync.rs +188 -0
  42. vertebra_spanner-0.3.0/rs/vertebra-core/src/telemetry.rs +197 -0
  43. vertebra_spanner-0.3.0/rs/vertebra-core/src/text.rs +1354 -0
  44. vertebra_spanner-0.3.0/rs/vertebra-core/src/tiered_ring.rs +170 -0
  45. vertebra_spanner-0.3.0/rs/vertebra-core/src/transport/mod.rs +2393 -0
  46. vertebra_spanner-0.3.0/rs/vertebra-core/src/transport/ring_pair.rs +1704 -0
  47. vertebra_spanner-0.3.0/rs/vertebra-core/src/util.rs +43 -0
  48. vertebra_spanner-0.3.0/rs/vertebra-core/src/vector.rs +2117 -0
  49. vertebra_spanner-0.3.0/rs/vertebra-core/tests/it/broker.rs +631 -0
  50. vertebra_spanner-0.3.0/rs/vertebra-core/tests/it/gcp_auth.rs +1891 -0
  51. vertebra_spanner-0.3.0/rs/vertebra-core/tests/it/main.rs +19 -0
  52. vertebra_spanner-0.3.0/rs/vertebra-core/tests/it/mpmc.rs +278 -0
  53. vertebra_spanner-0.3.0/rs/vertebra-core/tests/it/ring.rs +336 -0
  54. vertebra_spanner-0.3.0/rs/vertebra-core/tests/it/shm.rs +661 -0
  55. vertebra_spanner-0.3.0/rs/vertebra-core/tests/it/shm_streaming.rs +130 -0
  56. vertebra_spanner-0.3.0/rs/vertebra-db/Cargo.toml +107 -0
  57. vertebra_spanner-0.3.0/rs/vertebra-db/build.rs +11 -0
  58. vertebra_spanner-0.3.0/rs/vertebra-db/src/arrow_shm.rs +526 -0
  59. vertebra_spanner-0.3.0/rs/vertebra-db/src/aws_rds_root_cas.pem +2888 -0
  60. vertebra_spanner-0.3.0/rs/vertebra-db/src/broker_capsule.rs +1312 -0
  61. vertebra_spanner-0.3.0/rs/vertebra-db/src/connection.rs +1834 -0
  62. vertebra_spanner-0.3.0/rs/vertebra-db/src/dialer.rs +1760 -0
  63. vertebra_spanner-0.3.0/rs/vertebra-db/src/duckdb/mod.rs +101 -0
  64. vertebra_spanner-0.3.0/rs/vertebra-db/src/gcp.rs +268 -0
  65. vertebra_spanner-0.3.0/rs/vertebra-db/src/lease_guard.rs +147 -0
  66. vertebra_spanner-0.3.0/rs/vertebra-db/src/lib.rs +103 -0
  67. vertebra_spanner-0.3.0/rs/vertebra-db/src/mssql/mod.rs +216 -0
  68. vertebra_spanner-0.3.0/rs/vertebra-db/src/oracle/mod.rs +279 -0
  69. vertebra_spanner-0.3.0/rs/vertebra-db/src/oracle/tns.rs +277 -0
  70. vertebra_spanner-0.3.0/rs/vertebra-db/src/postgres/mod.rs +442 -0
  71. vertebra_spanner-0.3.0/rs/vertebra-db/src/py_async.rs +669 -0
  72. vertebra_spanner-0.3.0/rs/vertebra-db/src/py_broker.rs +98 -0
  73. vertebra_spanner-0.3.0/rs/vertebra-db/src/py_cursor.rs +241 -0
  74. vertebra_spanner-0.3.0/rs/vertebra-db/src/py_errors.rs +303 -0
  75. vertebra_spanner-0.3.0/rs/vertebra-db/tests/arrow_shm_stream_tests.rs +105 -0
  76. vertebra_spanner-0.3.0/rs/vertebra-db/tests/broker_engine_capsule_tests.rs +198 -0
  77. vertebra_spanner-0.3.0/rs/vertebra-db/tests/gcp_credentials_tests.rs +57 -0
  78. vertebra_spanner-0.3.0/rs/vertebra-db/tests/postgres_vector_tests.rs +114 -0
  79. vertebra_spanner-0.3.0/rs/vertebra-spanner/Cargo.toml +53 -0
  80. vertebra_spanner-0.3.0/rs/vertebra-spanner/build.rs +8 -0
  81. vertebra_spanner-0.3.0/rs/vertebra-spanner/src/arrow_ipc.rs +82 -0
  82. vertebra_spanner-0.3.0/rs/vertebra-spanner/src/client.rs +1184 -0
  83. vertebra_spanner-0.3.0/rs/vertebra-spanner/src/codec.rs +1951 -0
  84. vertebra_spanner-0.3.0/rs/vertebra-spanner/src/cursor.rs +1438 -0
  85. vertebra_spanner-0.3.0/rs/vertebra-spanner/src/errors.rs +167 -0
  86. vertebra_spanner-0.3.0/rs/vertebra-spanner/src/lib.rs +1200 -0
  87. vertebra_spanner-0.3.0/rs/vertebra-spanner/src/rw_tx.rs +1581 -0
  88. vertebra_spanner-0.3.0/rs/vertebra-spanner/tests/spanner_wire_tests.rs +2040 -0
@@ -0,0 +1,7 @@
1
+ Metadata-Version: 2.4
2
+ Name: vertebra-spanner
3
+ Version: 0.3.0
4
+ Requires-Dist: vertebra-core==0.3.0
5
+ Summary: Native Rust Google Cloud Spanner client extension for Vertebra.
6
+ License: MIT
7
+ Requires-Python: >=3.12
@@ -0,0 +1,577 @@
1
+ """Type stubs for the vertebra._spanner native extension module."""
2
+
3
+ from collections.abc import Awaitable, Callable, Mapping, Sequence
4
+ from typing import Any, TypedDict, final, type_check_only
5
+
6
+ @type_check_only
7
+ class SpannerFieldSchema(TypedDict):
8
+ """Cloud Spanner query result column schema descriptor."""
9
+
10
+ name: str
11
+ """Result column name."""
12
+ type: str
13
+ """Cloud Spanner column type identifier."""
14
+
15
+ @type_check_only
16
+ class SpannerQueryResult(TypedDict):
17
+ """Cloud Spanner query result payload."""
18
+
19
+ columns: list[str]
20
+ """Ordered output column names."""
21
+ schema: list[SpannerFieldSchema]
22
+ """Schema descriptors for result columns."""
23
+ rows: list[list[Any]]
24
+ """Decoded tabular result rows."""
25
+ row_count_exact: int | None
26
+ """Exact affected row count for DML statements."""
27
+ row_count_lower_bound: int | None
28
+ """Lower bound on affected row count for PDML statements."""
29
+
30
+ @type_check_only
31
+ class SpannerCommitResult(TypedDict):
32
+ """Cloud Spanner transaction commit summary."""
33
+
34
+ commit_timestamp_micros: int | None
35
+ """Server-assigned commit timestamp in Unix microseconds."""
36
+ mutation_count: int | None
37
+ """Applied mutation count returned when commit stats are enabled."""
38
+ retry_count: int
39
+ """Number of transient retry attempts performed before commit succeeded."""
40
+
41
+ @type_check_only
42
+ class SpannerBatchWriteResult(TypedDict):
43
+ """Cloud Spanner BatchWrite mutation group status payload."""
44
+
45
+ indexes: list[int]
46
+ """Indexes of mutation groups covered by this status entry."""
47
+ status_code: int
48
+ """gRPC status code for the mutation group batch."""
49
+ status_message: str
50
+ """Human-readable status message returned by Spanner."""
51
+ commit_timestamp_micros: int | None
52
+ """Commit timestamp in Unix microseconds when the batch succeeded."""
53
+
54
+ __version__: str
55
+ FREE_THREADED: bool
56
+ GIL_USED: bool
57
+
58
+ __all__ = [
59
+ "FREE_THREADED",
60
+ "GIL_USED",
61
+ "AsyncSpannerClient",
62
+ "AsyncSpannerCursor",
63
+ "AsyncSpannerReadWriteTransaction",
64
+ "SyncSpannerClient",
65
+ "SyncSpannerCursor",
66
+ "SyncSpannerReadWriteTransaction",
67
+ "__version__",
68
+ ]
69
+
70
+ @final
71
+ class SyncSpannerCursor:
72
+ """Synchronous PEP 249 cursor backed by a Cloud Spanner client or transaction."""
73
+
74
+ @property
75
+ def description(self) -> tuple[tuple[str, str, None, None, None, None, None], ...] | None:
76
+ """Return PEP 249 column metadata tuples, or `None` when no result set is active."""
77
+ ...
78
+ @property
79
+ def rowcount(self) -> int:
80
+ """Return the affected or buffered row count, or `-1` when unavailable."""
81
+ ...
82
+ @property
83
+ def lastrowid(self) -> Any | None:
84
+ """Return the last inserted row identifier, or `None` for Spanner."""
85
+ ...
86
+ @property
87
+ def arraysize(self) -> int:
88
+ """Return the default row batch size used by `fetchmany()`."""
89
+ ...
90
+ @arraysize.setter
91
+ def arraysize(self, value: int) -> None:
92
+ """Set the default row batch size used by `fetchmany()`."""
93
+ ...
94
+ def execute(
95
+ self,
96
+ sql: str,
97
+ params: str | Sequence[Any] | Mapping[str, Any] = (),
98
+ ) -> SyncSpannerCursor:
99
+ """Execute a query, DML, or DDL statement and buffer its result on this cursor."""
100
+ ...
101
+ def executemany(
102
+ self,
103
+ sql: str,
104
+ seq_of_params: Sequence[str | Sequence[Any] | Mapping[str, Any]],
105
+ ) -> SyncSpannerCursor:
106
+ """Execute a DML statement for each parameter set as one batch-DML call."""
107
+ ...
108
+ def fetchone(self) -> tuple[Any, ...] | None:
109
+ """Return the next buffered row tuple, or `None` when exhausted."""
110
+ ...
111
+ def fetchmany(self, size: int | None = None) -> list[tuple[Any, ...]]:
112
+ """Return up to `size` buffered row tuples, defaulting to `arraysize`."""
113
+ ...
114
+ def fetchall(self) -> list[tuple[Any, ...]]:
115
+ """Return all remaining buffered row tuples."""
116
+ ...
117
+ def close(self) -> None:
118
+ """Close the cursor idempotently and release buffered rows."""
119
+ ...
120
+ def __enter__(self) -> SyncSpannerCursor:
121
+ """Enter a context manager block returning this cursor."""
122
+ ...
123
+ def __exit__(
124
+ self,
125
+ exc_type: type[BaseException] | None = None,
126
+ exc_value: BaseException | None = None,
127
+ traceback: Any | None = None,
128
+ ) -> bool:
129
+ """Exit a context manager block and close this cursor."""
130
+ ...
131
+
132
+ @final
133
+ class AsyncSpannerCursor:
134
+ """Asynchronous PEP 249 cursor backed by a Cloud Spanner client or transaction."""
135
+
136
+ @property
137
+ def description(self) -> tuple[tuple[str, str, None, None, None, None, None], ...] | None:
138
+ """Return PEP 249 column metadata tuples, or `None` when no result set is active."""
139
+ ...
140
+ @property
141
+ def rowcount(self) -> int:
142
+ """Return the affected or buffered row count, or `-1` when unavailable."""
143
+ ...
144
+ @property
145
+ def lastrowid(self) -> Any | None:
146
+ """Return the last inserted row identifier, or `None` for Spanner."""
147
+ ...
148
+ @property
149
+ def arraysize(self) -> int:
150
+ """Return the default row batch size used by `fetchmany()`."""
151
+ ...
152
+ @arraysize.setter
153
+ def arraysize(self, value: int) -> None:
154
+ """Set the default row batch size used by `fetchmany()`."""
155
+ ...
156
+ def execute(
157
+ self,
158
+ sql: str,
159
+ params: str | Sequence[Any] | Mapping[str, Any] = (),
160
+ ) -> Awaitable[AsyncSpannerCursor]:
161
+ """Execute a query, DML, or DDL statement asynchronously and buffer its result."""
162
+ ...
163
+ def executemany(
164
+ self,
165
+ sql: str,
166
+ seq_of_params: Sequence[str | Sequence[Any] | Mapping[str, Any]],
167
+ ) -> Awaitable[AsyncSpannerCursor]:
168
+ """Execute a DML statement for each parameter set asynchronously as one batch-DML call."""
169
+ ...
170
+ def fetchone(self) -> Awaitable[tuple[Any, ...] | None]:
171
+ """Return the next buffered row tuple asynchronously, or `None` when exhausted."""
172
+ ...
173
+ def fetchmany(self, size: int | None = None) -> Awaitable[list[tuple[Any, ...]]]:
174
+ """Return up to `size` buffered row tuples asynchronously, defaulting to `arraysize`."""
175
+ ...
176
+ def fetchall(self) -> Awaitable[list[tuple[Any, ...]]]:
177
+ """Return all remaining buffered row tuples asynchronously."""
178
+ ...
179
+ def close(self) -> Awaitable[None]:
180
+ """Close the cursor idempotently and release buffered rows asynchronously."""
181
+ ...
182
+
183
+ @final
184
+ class SyncSpannerReadWriteTransaction:
185
+ """Stateful synchronous Cloud Spanner interactive ReadWrite transaction handle."""
186
+
187
+ @property
188
+ def transaction_id(self) -> bytes:
189
+ """Return the server-assigned Cloud Spanner transaction identifier bytes."""
190
+ ...
191
+ def query(
192
+ self,
193
+ sql: str,
194
+ params_json: str | None = None,
195
+ request_tag: str | None = None,
196
+ ) -> SpannerQueryResult:
197
+ """Execute a SQL query inside this transaction and return result columns, schema, and rows."""
198
+ ...
199
+ def execute_dml(
200
+ self,
201
+ sql: str,
202
+ params_json: str | None = None,
203
+ request_tag: str | None = None,
204
+ ) -> int:
205
+ """Execute a DML statement inside this transaction and return the affected row count."""
206
+ ...
207
+ def execute_batch_dml(
208
+ self,
209
+ statements_json: str,
210
+ request_tag: str | None = None,
211
+ ) -> list[int]:
212
+ """Execute a batch of DML statements inside this transaction and return per-statement row counts."""
213
+ ...
214
+ def commit(
215
+ self,
216
+ mutations_json: str | None = None,
217
+ ) -> SpannerCommitResult:
218
+ """Commit this transaction with optional buffered mutations and return commit statistics."""
219
+ ...
220
+ def rollback(self) -> None:
221
+ """Explicitly roll back this transaction."""
222
+ ...
223
+ def cursor(
224
+ self,
225
+ *,
226
+ request_tag: str | None = None,
227
+ param_encoder: Callable[[Any], str | None] | None = None,
228
+ ) -> SyncSpannerCursor:
229
+ """Create a synchronous PEP 249 cursor bound to this transaction."""
230
+ ...
231
+
232
+ @final
233
+ class AsyncSpannerReadWriteTransaction:
234
+ """Stateful asynchronous Cloud Spanner interactive ReadWrite transaction handle."""
235
+
236
+ @property
237
+ def transaction_id(self) -> bytes:
238
+ """Return the server-assigned Cloud Spanner transaction identifier bytes."""
239
+ ...
240
+ def query(
241
+ self,
242
+ sql: str,
243
+ params_json: str | None = None,
244
+ request_tag: str | None = None,
245
+ ) -> Awaitable[SpannerQueryResult]:
246
+ """Execute a SQL query inside this transaction asynchronously."""
247
+ ...
248
+ def execute_dml(
249
+ self,
250
+ sql: str,
251
+ params_json: str | None = None,
252
+ request_tag: str | None = None,
253
+ ) -> Awaitable[int]:
254
+ """Execute a DML statement inside this transaction asynchronously."""
255
+ ...
256
+ def execute_batch_dml(
257
+ self,
258
+ statements_json: str,
259
+ request_tag: str | None = None,
260
+ ) -> Awaitable[list[int]]:
261
+ """Execute a batch of DML statements inside this transaction asynchronously."""
262
+ ...
263
+ def commit(
264
+ self,
265
+ mutations_json: str | None = None,
266
+ ) -> Awaitable[SpannerCommitResult]:
267
+ """Commit this transaction with optional buffered mutations asynchronously."""
268
+ ...
269
+ def rollback(self) -> Awaitable[None]:
270
+ """Explicitly roll back this transaction asynchronously."""
271
+ ...
272
+ def cursor(
273
+ self,
274
+ *,
275
+ request_tag: str | None = None,
276
+ param_encoder: Callable[[Any], str | None] | None = None,
277
+ ) -> AsyncSpannerCursor:
278
+ """Create an asynchronous PEP 249 cursor bound to this transaction."""
279
+ ...
280
+
281
+ @final
282
+ class SyncSpannerClient:
283
+ """Synchronous Google Cloud Spanner client built on the official Rust client.
284
+
285
+ ``query`` and ``partitioned_query`` return ``columns``, ``schema``, ``rows``,
286
+ ``row_count_exact``, and ``row_count_lower_bound``. ``ca_pem`` is accepted
287
+ only for non-googleapis ``https://`` endpoints (Spanner Omni or private test
288
+ servers).
289
+ """
290
+
291
+ def __new__(
292
+ cls,
293
+ database: str,
294
+ database_role: str | None = None,
295
+ endpoint: str | None = None,
296
+ dialect: str = "googlesql",
297
+ pool_size: int = 4,
298
+ route_to_leader_enabled: bool = True,
299
+ max_commit_delay_ms: int | None = None,
300
+ auth_options: dict[str, str] | None = None,
301
+ admin_endpoint: str | None = None,
302
+ ca_pem: bytes | None = None,
303
+ ) -> SyncSpannerClient:
304
+ """Initialize a synchronous Cloud Spanner client handle."""
305
+ ...
306
+ @property
307
+ def database(self) -> str:
308
+ """Return the full `projects/{p}/instances/{i}/databases/{d}` resource URI."""
309
+ ...
310
+ @property
311
+ def database_role(self) -> str | None:
312
+ """Return the configured fine-grained access control database role, if any."""
313
+ ...
314
+ @property
315
+ def endpoint(self) -> str:
316
+ """Return the effective Cloud Spanner Data API gRPC endpoint."""
317
+ ...
318
+ @property
319
+ def admin_endpoint(self) -> str | None:
320
+ """Return the configured Cloud Spanner Database Admin REST endpoint, if any."""
321
+ ...
322
+ @property
323
+ def dialect(self) -> str:
324
+ """Return the SQL dialect (`googlesql` or `spangres`)."""
325
+ ...
326
+ @property
327
+ def pool_size(self) -> int:
328
+ """Return the configured gRPC channel pool size."""
329
+ ...
330
+ @property
331
+ def route_to_leader_enabled(self) -> bool:
332
+ """Return whether leader-aware routing headers are enabled."""
333
+ ...
334
+ @property
335
+ def max_commit_delay_ms(self) -> int | None:
336
+ """Return the configured maximum commit batching delay in milliseconds, if any."""
337
+ ...
338
+ def query(
339
+ self,
340
+ sql: str,
341
+ params_json: str | None = None,
342
+ staleness_mode: str = "strong",
343
+ staleness_ms: int = 0,
344
+ ) -> SpannerQueryResult:
345
+ """Execute a streaming SQL read at the requested staleness bound."""
346
+ ...
347
+ def execute_dml(
348
+ self,
349
+ sql: str,
350
+ params_json: str | None = None,
351
+ request_tag: str | None = None,
352
+ transaction_tag: str | None = None,
353
+ ) -> int:
354
+ """Execute a transactional DML statement and return the affected row count."""
355
+ ...
356
+ def execute_batch_dml(
357
+ self,
358
+ statements_json: str,
359
+ request_tag: str | None = None,
360
+ transaction_tag: str | None = None,
361
+ ) -> list[int]:
362
+ """Execute a batch of DML statements and return per-statement affected row counts."""
363
+ ...
364
+ def execute_partitioned_dml(
365
+ self,
366
+ sql: str,
367
+ params_json: str | None = None,
368
+ exclude_txn_from_change_streams: bool = False,
369
+ ) -> int:
370
+ """Execute a Partitioned DML statement and return the lower-bound affected row count."""
371
+ ...
372
+ def apply_mutations(
373
+ self,
374
+ mutations_json: str,
375
+ transaction_tag: str | None = None,
376
+ exclude_txn_from_change_streams: bool = False,
377
+ max_commit_delay_ms: int | None = None,
378
+ ) -> SpannerCommitResult:
379
+ """Commit a JSON-encoded list of Spanner mutations and return commit statistics."""
380
+ ...
381
+ def batch_write(
382
+ self,
383
+ mutation_groups_json: str,
384
+ exclude_txn_from_change_streams: bool = False,
385
+ ) -> list[SpannerBatchWriteResult]:
386
+ """Commit independent mutation groups via `BatchWrite` and return per-group statuses."""
387
+ ...
388
+ def update_ddl(
389
+ self,
390
+ statements: Sequence[str],
391
+ ) -> str:
392
+ """Execute one or more schema DDL statements via `UpdateDatabaseDdl`."""
393
+ ...
394
+ def partitioned_query(
395
+ self,
396
+ sql: str,
397
+ params_json: str | None = None,
398
+ max_partitions: int = 4,
399
+ data_boost_enabled: bool = False,
400
+ staleness_mode: str = "strong",
401
+ staleness_ms: int = 0,
402
+ ) -> SpannerQueryResult:
403
+ """Execute a parallel `PartitionQuery` read with optional Spanner Data Boost."""
404
+ ...
405
+ def begin_read_write_transaction(
406
+ self,
407
+ transaction_tag: str | None = None,
408
+ previous_transaction_id: bytes | None = None,
409
+ exclude_txn_from_change_streams: bool = False,
410
+ max_commit_delay_ms: int | None = None,
411
+ ) -> SyncSpannerReadWriteTransaction:
412
+ """Open a stateful synchronous interactive ReadWrite transaction handle."""
413
+ ...
414
+ def cursor(
415
+ self,
416
+ *,
417
+ staleness_mode: str = "strong",
418
+ staleness_value: int = 0,
419
+ request_tag: str | None = None,
420
+ transaction_tag: str | None = None,
421
+ param_encoder: Callable[[Any], str | None] | None = None,
422
+ lazy_begin: bool = False,
423
+ ) -> SyncSpannerCursor:
424
+ """Create a synchronous PEP 249 cursor backed by this client."""
425
+ ...
426
+ def close(self) -> None:
427
+ """Close the client handle."""
428
+ ...
429
+
430
+ @final
431
+ class AsyncSpannerClient:
432
+ """Asynchronous Google Cloud Spanner client built on the official Rust client.
433
+
434
+ ``query`` and ``partitioned_query`` return ``columns``, ``schema``, ``rows``,
435
+ ``row_count_exact``, and ``row_count_lower_bound``. ``ca_pem`` is accepted
436
+ only for non-googleapis ``https://`` endpoints (Spanner Omni or private test
437
+ servers).
438
+ """
439
+
440
+ def __new__(
441
+ cls,
442
+ database: str,
443
+ database_role: str | None = None,
444
+ endpoint: str | None = None,
445
+ dialect: str = "googlesql",
446
+ pool_size: int = 4,
447
+ route_to_leader_enabled: bool = True,
448
+ max_commit_delay_ms: int | None = None,
449
+ auth_options: dict[str, str] | None = None,
450
+ admin_endpoint: str | None = None,
451
+ ca_pem: bytes | None = None,
452
+ ) -> AsyncSpannerClient:
453
+ """Initialize an asynchronous Cloud Spanner client handle."""
454
+ ...
455
+ @property
456
+ def database(self) -> str:
457
+ """Return the full `projects/{p}/instances/{i}/databases/{d}` resource URI."""
458
+ ...
459
+ @property
460
+ def database_role(self) -> str | None:
461
+ """Return the configured fine-grained access control database role, if any."""
462
+ ...
463
+ @property
464
+ def endpoint(self) -> str:
465
+ """Return the effective Cloud Spanner Data API gRPC endpoint."""
466
+ ...
467
+ @property
468
+ def admin_endpoint(self) -> str | None:
469
+ """Return the configured Cloud Spanner Database Admin REST endpoint, if any."""
470
+ ...
471
+ @property
472
+ def dialect(self) -> str:
473
+ """Return the SQL dialect (`googlesql` or `spangres`)."""
474
+ ...
475
+ @property
476
+ def pool_size(self) -> int:
477
+ """Return the configured gRPC channel pool size."""
478
+ ...
479
+ @property
480
+ def route_to_leader_enabled(self) -> bool:
481
+ """Return whether leader-aware routing headers are enabled."""
482
+ ...
483
+ @property
484
+ def max_commit_delay_ms(self) -> int | None:
485
+ """Return the configured maximum commit batching delay in milliseconds, if any."""
486
+ ...
487
+ def query(
488
+ self,
489
+ sql: str,
490
+ params_json: str | None = None,
491
+ staleness_mode: str = "strong",
492
+ staleness_ms: int = 0,
493
+ ) -> Awaitable[SpannerQueryResult]:
494
+ """Execute a streaming SQL read asynchronously on the shared Tokio runtime."""
495
+ ...
496
+ def execute_dml(
497
+ self,
498
+ sql: str,
499
+ params_json: str | None = None,
500
+ request_tag: str | None = None,
501
+ transaction_tag: str | None = None,
502
+ ) -> Awaitable[int]:
503
+ """Execute a transactional DML statement asynchronously."""
504
+ ...
505
+ def execute_batch_dml(
506
+ self,
507
+ statements_json: str,
508
+ request_tag: str | None = None,
509
+ transaction_tag: str | None = None,
510
+ ) -> Awaitable[list[int]]:
511
+ """Execute a batch of DML statements asynchronously."""
512
+ ...
513
+ def execute_partitioned_dml(
514
+ self,
515
+ sql: str,
516
+ params_json: str | None = None,
517
+ exclude_txn_from_change_streams: bool = False,
518
+ ) -> Awaitable[int]:
519
+ """Execute a Partitioned DML statement asynchronously."""
520
+ ...
521
+ def apply_mutations(
522
+ self,
523
+ mutations_json: str,
524
+ transaction_tag: str | None = None,
525
+ exclude_txn_from_change_streams: bool = False,
526
+ max_commit_delay_ms: int | None = None,
527
+ ) -> Awaitable[SpannerCommitResult]:
528
+ """Commit a JSON-encoded list of Spanner mutations asynchronously."""
529
+ ...
530
+ def batch_write(
531
+ self,
532
+ mutation_groups_json: str,
533
+ exclude_txn_from_change_streams: bool = False,
534
+ ) -> Awaitable[list[SpannerBatchWriteResult]]:
535
+ """Commit independent mutation groups asynchronously via `BatchWrite`."""
536
+ ...
537
+ def update_ddl(
538
+ self,
539
+ statements: Sequence[str],
540
+ ) -> Awaitable[str]:
541
+ """Execute one or more schema DDL statements asynchronously via `UpdateDatabaseDdl`."""
542
+ ...
543
+ def partitioned_query(
544
+ self,
545
+ sql: str,
546
+ params_json: str | None = None,
547
+ max_partitions: int = 4,
548
+ data_boost_enabled: bool = False,
549
+ staleness_mode: str = "strong",
550
+ staleness_ms: int = 0,
551
+ ) -> Awaitable[SpannerQueryResult]:
552
+ """Execute a parallel `PartitionQuery` read asynchronously with optional Data Boost."""
553
+ ...
554
+ def begin_read_write_transaction(
555
+ self,
556
+ transaction_tag: str | None = None,
557
+ previous_transaction_id: bytes | None = None,
558
+ exclude_txn_from_change_streams: bool = False,
559
+ max_commit_delay_ms: int | None = None,
560
+ ) -> Awaitable[AsyncSpannerReadWriteTransaction]:
561
+ """Open a stateful asynchronous interactive ReadWrite transaction handle."""
562
+ ...
563
+ def cursor(
564
+ self,
565
+ *,
566
+ staleness_mode: str = "strong",
567
+ staleness_value: int = 0,
568
+ request_tag: str | None = None,
569
+ transaction_tag: str | None = None,
570
+ param_encoder: Callable[[Any], str | None] | None = None,
571
+ lazy_begin: bool = False,
572
+ ) -> AsyncSpannerCursor:
573
+ """Create an asynchronous PEP 249 cursor backed by this client."""
574
+ ...
575
+ def close(self) -> None:
576
+ """Close the client handle."""
577
+ ...