arrowsql 0.1.0__cp313-cp313-win_amd64.whl

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 (45) hide show
  1. arrowsql/__init__.py +653 -0
  2. arrowsql/_rust_auth.py +170 -0
  3. arrowsql/_server_sqlstate.py +11 -0
  4. arrowsql/_utf8_strings.py +78 -0
  5. arrowsql/agent.py +620 -0
  6. arrowsql/aio.py +533 -0
  7. arrowsql/arrow_parallel.py +464 -0
  8. arrowsql/async_query/__init__.py +40 -0
  9. arrowsql/async_query/_connection_context.py +39 -0
  10. arrowsql/async_query/_native.py +24 -0
  11. arrowsql/async_query/async_connection.py +160 -0
  12. arrowsql/async_query/async_cursor.py +225 -0
  13. arrowsql/async_query/async_execute.py +113 -0
  14. arrowsql/async_query/async_fetch.py +153 -0
  15. arrowsql/async_query/exception_translator.py +132 -0
  16. arrowsql/auth.py +913 -0
  17. arrowsql/bulk_parallel.py +385 -0
  18. arrowsql/connection.py +2377 -0
  19. arrowsql/connection_string_builder.py +114 -0
  20. arrowsql/connection_string_parser.py +417 -0
  21. arrowsql/constants.py +701 -0
  22. arrowsql/cursor.py +4516 -0
  23. arrowsql/db_connection.py +98 -0
  24. arrowsql/ddbc_bindings.cp313-win_amd64.pyd +0 -0
  25. arrowsql/ddbc_bindings.pyi +283 -0
  26. arrowsql/decimal_config.py +98 -0
  27. arrowsql/exceptions.py +378 -0
  28. arrowsql/helpers.py +436 -0
  29. arrowsql/logging.py +700 -0
  30. arrowsql/mssql_python.pyi +579 -0
  31. arrowsql/odbc_provider.py +269 -0
  32. arrowsql/parameter_helper.py +442 -0
  33. arrowsql/perf_timer.py +286 -0
  34. arrowsql/pooling.py +147 -0
  35. arrowsql/py.typed +1 -0
  36. arrowsql/row.py +462 -0
  37. arrowsql/type.py +160 -0
  38. arrowsql-0.1.0.dist-info/METADATA +146 -0
  39. arrowsql-0.1.0.dist-info/RECORD +45 -0
  40. arrowsql-0.1.0.dist-info/WHEEL +4 -0
  41. arrowsql-0.1.0.dist-info/entry_points.txt +2 -0
  42. arrowsql-0.1.0.dist-info/licenses/LICENSE +21 -0
  43. arrowsql-0.1.0.dist-info/licenses/LICENSE.upstream-mssql-python +47 -0
  44. arrowsql-0.1.0.dist-info/sboms/ddbc_bindings.cyclonedx.json +5195 -0
  45. mssql_python/__init__.py +39 -0
@@ -0,0 +1,579 @@
1
+ """
2
+ Copyright (c) Microsoft Corporation.
3
+ Licensed under the MIT license.
4
+ Type stubs for mssql_python package - based on actual public API
5
+ """
6
+
7
+ from typing import (
8
+ Any,
9
+ Dict,
10
+ List,
11
+ Mapping,
12
+ Optional,
13
+ Union,
14
+ Tuple,
15
+ Sequence,
16
+ Callable,
17
+ Iterator,
18
+ Iterable,
19
+ Protocol,
20
+ )
21
+ import datetime
22
+ import logging
23
+ import pyarrow
24
+ from . import ddbc_bindings # RUST-PORT: Arrow result types
25
+ from . import aio as aio # RUST-PORT: native asyncio
26
+
27
+ # GLOBALS - DB-API 2.0 Required Module Globals
28
+ # https://www.python.org/dev/peps/pep-0249/#module-interface
29
+ apilevel: str # "2.0"
30
+ paramstyle: str # "qmark"
31
+ threadsafety: int # 1
32
+
33
+ # Module Settings - Properties that can be get/set at module level
34
+ lowercase: bool # Controls column name case behavior
35
+ native_uuid: bool # Controls UUID type handling
36
+ native_provider: Optional[str] # Selects the native ODBC provider ('msodbcsql18' or 'mssql-odbc')
37
+
38
+ # Settings Class
39
+ class Settings:
40
+ lowercase: bool
41
+ decimal_separator: str
42
+ native_uuid: bool
43
+ def __init__(self) -> None: ...
44
+
45
+ # Module-level Configuration Functions
46
+ def get_settings() -> Settings: ...
47
+ def setDecimalSeparator(separator: str) -> None: ...
48
+ def getDecimalSeparator() -> str: ...
49
+ def pooling(max_size: int = 100, idle_timeout: int = 600, enabled: bool = True) -> None: ...
50
+ def get_native_provider_info() -> Dict[str, object]: ...
51
+ def get_info_constants() -> Dict[str, int]: ...
52
+
53
+ # Logging Functions
54
+ def setup_logging(output: str = "file", log_file_path: Optional[str] = None) -> None: ...
55
+ def get_logger() -> Optional[logging.Logger]: ...
56
+
57
+ # DB-API 2.0 Type Objects
58
+ # https://www.python.org/dev/peps/pep-0249/#type-objects
59
+ class STRING:
60
+ """Type object for string-based database columns (e.g. CHAR, VARCHAR)."""
61
+
62
+ ...
63
+
64
+ class BINARY:
65
+ """Type object for binary database columns (e.g. BINARY, VARBINARY)."""
66
+
67
+ ...
68
+
69
+ class NUMBER:
70
+ """Type object for numeric database columns (e.g. INT, DECIMAL)."""
71
+
72
+ ...
73
+
74
+ class DATETIME:
75
+ """Type object for date/time database columns (e.g. DATE, TIMESTAMP)."""
76
+
77
+ ...
78
+
79
+ class ROWID:
80
+ """Type object for row identifier columns."""
81
+
82
+ ...
83
+
84
+ # DB-API 2.0 Type Constructors
85
+ # https://www.python.org/dev/peps/pep-0249/#type-constructors
86
+ def Date(year: int, month: int, day: int) -> datetime.date: ...
87
+ def Time(hour: int, minute: int, second: int) -> datetime.time: ...
88
+ def Timestamp(
89
+ year: int,
90
+ month: int,
91
+ day: int,
92
+ hour: int,
93
+ minute: int,
94
+ second: int,
95
+ microsecond: int = 0,
96
+ ) -> datetime.datetime: ...
97
+ def DateFromTicks(ticks: int) -> datetime.date: ...
98
+ def TimeFromTicks(ticks: int) -> datetime.time: ...
99
+ def TimestampFromTicks(ticks: int) -> datetime.datetime: ...
100
+ def Binary(value: Union[str, bytes, bytearray, memoryview]) -> bytes: ...
101
+
102
+ # DB-API 2.0 Exception Hierarchy
103
+ # https://www.python.org/dev/peps/pep-0249/#exceptions
104
+ class Warning(Exception):
105
+ def __init__(
106
+ self,
107
+ driver_error: str,
108
+ ddbc_error: str,
109
+ sqlstate: Optional[str] = None,
110
+ native_error: Optional[int] = None,
111
+ ) -> None: ...
112
+ driver_error: str
113
+ ddbc_error: str
114
+ message: str
115
+
116
+ class Error(Exception):
117
+ def __init__(
118
+ self,
119
+ driver_error: str,
120
+ ddbc_error: str,
121
+ sqlstate: Optional[str] = None,
122
+ native_error: Optional[int] = None,
123
+ ) -> None: ...
124
+ driver_error: str
125
+ ddbc_error: str
126
+ message: str
127
+
128
+ class InterfaceError(Error): ...
129
+
130
+ class DatabaseError(Error): ...
131
+
132
+ class DataError(DatabaseError): ...
133
+
134
+ class OperationalError(DatabaseError): ...
135
+
136
+ class IntegrityError(DatabaseError): ...
137
+
138
+ class InternalError(DatabaseError): ...
139
+
140
+ class ProgrammingError(DatabaseError): ...
141
+
142
+ class NotSupportedError(DatabaseError): ...
143
+
144
+ # Row Object
145
+ class Row:
146
+ """
147
+ Represents a database result row.
148
+
149
+ Supports both index-based and name-based column access.
150
+ """
151
+
152
+ def __init__(
153
+ self,
154
+ values: List[Any],
155
+ column_map: Dict[str, int],
156
+ cursor: Optional["Cursor"] = None,
157
+ converter_map: Optional[List[Any]] = None,
158
+ uuid_str_indices: Optional[Tuple[int, ...]] = None,
159
+ column_map_lower: Optional[Dict[str, int]] = None,
160
+ column_names: Optional[Tuple[str, ...]] = None,
161
+ ) -> None: ...
162
+ @property
163
+ def _mapping(self) -> "RowMapping": ...
164
+ def __getitem__(self, index: int) -> Any: ...
165
+ def __getattr__(self, name: str) -> Any: ...
166
+ def __eq__(self, other: Any) -> bool: ...
167
+ def __len__(self) -> int: ...
168
+ def __iter__(self) -> Iterator[Any]: ...
169
+ def __str__(self) -> str: ...
170
+ def __repr__(self) -> str: ...
171
+
172
+ class RowMapping(Mapping[str, Any]):
173
+ """Read-only mapping view (column name -> value) over a Row."""
174
+
175
+ def __init__(self, row: "Row") -> None: ...
176
+ def __getitem__(self, key: str) -> Any: ...
177
+ def __iter__(self) -> Iterator[str]: ...
178
+ def __len__(self) -> int: ...
179
+ def __repr__(self) -> str: ...
180
+
181
+ # DB-API 2.0 Cursor Object
182
+ # https://www.python.org/dev/peps/pep-0249/#cursor-objects
183
+ class Cursor:
184
+ """
185
+ Database cursor for executing SQL operations and fetching results.
186
+
187
+ This class should not be instantiated directly. Use Connection.cursor() instead.
188
+ """
189
+
190
+ # DB-API 2.0 Required Attributes
191
+ description: Optional[
192
+ List[
193
+ Tuple[
194
+ str,
195
+ Any,
196
+ Optional[int],
197
+ Optional[int],
198
+ Optional[int],
199
+ Optional[int],
200
+ Optional[bool],
201
+ ]
202
+ ]
203
+ ]
204
+ rowcount: int
205
+ arraysize: int
206
+
207
+ # Extension Attributes
208
+ closed: bool
209
+ messages: List[str]
210
+
211
+ @property
212
+ def rownumber(self) -> int: ...
213
+ @property
214
+ def connection(self) -> "Connection": ...
215
+ def __init__(self, connection: "Connection", timeout: int = 0) -> None: ...
216
+
217
+ # DB-API 2.0 Required Methods
218
+ def callproc(
219
+ self, procname: str, parameters: Optional[Sequence[Any]] = None
220
+ ) -> Optional[Sequence[Any]]: ...
221
+ def close(self) -> None: ...
222
+ def execute(
223
+ self,
224
+ operation: str,
225
+ *parameters: Any,
226
+ use_prepare: bool = True,
227
+ reset_cursor: bool = True,
228
+ ) -> "Cursor": ...
229
+ def executemany(
230
+ self,
231
+ operation: str,
232
+ seq_of_parameters: Union[Sequence[Sequence[Any]], Sequence[Mapping[str, Any]]],
233
+ ) -> None: ...
234
+ def fetchone(self) -> Optional[Row]: ...
235
+ def fetchmany(self, size: Optional[int] = None) -> List[Row]: ...
236
+ def fetchall(self) -> List[Row]: ...
237
+ def nextset(self) -> Optional[bool]: ...
238
+ def setinputsizes(self, sizes: List[Union[int, Tuple[Any, ...]]]) -> None: ...
239
+ def setoutputsize(self, size: int, column: Optional[int] = None) -> None: ...
240
+
241
+ # Arrow Extension Methods (requires pyarrow)
242
+ def arrow_batch(self, batch_size: int = 8192) -> pyarrow.RecordBatch: ...
243
+ def arrow(self, batch_size: int = 8192) -> pyarrow.Table: ...
244
+ def arrow_reader(self, batch_size: int = 8192) -> "_ArrowReader": ...
245
+
246
+ # pyarrow.RecordBatchReader-compatible wrapper returned by Cursor.arrow_reader.
247
+ # Not part of the DB-API 2.0 surface and not intended to be instantiated
248
+ # directly by users; declared here so the return type of arrow_reader is
249
+ # accurate for static type checkers. Attributes not listed here (e.g.
250
+ # ``read_all``, ``read_pandas``, ``cast``) are delegated at runtime to the
251
+ # wrapped ``pyarrow.RecordBatchReader`` via ``__getattr__``.
252
+ class _ArrowReader:
253
+ @property
254
+ def closed(self) -> bool: ...
255
+ @property
256
+ def schema(self) -> pyarrow.Schema: ...
257
+ def read_next_batch(self) -> pyarrow.RecordBatch: ...
258
+ def close(self) -> None: ...
259
+ def __arrow_c_stream__(self, requested_schema: Any = ...) -> Any: ...
260
+ def __iter__(self) -> "_ArrowReader": ...
261
+ def __next__(self) -> pyarrow.RecordBatch: ...
262
+ def __enter__(self) -> "_ArrowReader": ...
263
+ def __exit__(self, exc_type: Any, exc: Any, tb: Any) -> None: ...
264
+ def __getattr__(self, name: str) -> Any: ...
265
+
266
+ # Bulk Copy
267
+ def bulkcopy(
268
+ self,
269
+ table_name: str,
270
+ data: Iterable[Union[Tuple[Any, ...], Row]],
271
+ batch_size: int = 0,
272
+ timeout: int = 30,
273
+ column_mappings: Optional[Union[List[str], List[Tuple[int, str]]]] = None,
274
+ keep_identity: bool = False,
275
+ check_constraints: bool = False,
276
+ table_lock: bool = False,
277
+ keep_nulls: bool = False,
278
+ fire_triggers: bool = False,
279
+ use_internal_transaction: bool = False,
280
+ ) -> Dict[str, Any]: ...
281
+ def bulkcopy_arrow(
282
+ self,
283
+ table_name: str,
284
+ source: Any,
285
+ batch_size: int = 0,
286
+ timeout: int = 30,
287
+ column_mappings: Optional[Union[List[str], List[Tuple[int, str]]]] = None,
288
+ keep_identity: bool = False,
289
+ check_constraints: bool = False,
290
+ table_lock: bool = False,
291
+ keep_nulls: bool = False,
292
+ fire_triggers: bool = False,
293
+ use_internal_transaction: bool = False,
294
+ ) -> Dict[str, Any]: ...
295
+
296
+ # --- RUST-PORT: native Arrow fetch (zero-dependency, Arrow PyCapsule interface) ---
297
+ def execute_arrow(
298
+ self,
299
+ operation: str,
300
+ params: Optional[Any] = None,
301
+ *,
302
+ utf8_strings: bool = True,
303
+ batch_size: int = 65536,
304
+ ) -> "ddbc_bindings.ArrowTable": ...
305
+ def fetchall_arrow(self, batch_size: int = 65536) -> "ddbc_bindings.ArrowTable": ...
306
+ def fetchmany_arrow(
307
+ self, size: Optional[int] = None, batch_size: int = 65536
308
+ ) -> "ddbc_bindings.ArrowTable": ...
309
+ def arrow_stream(
310
+ self, batch_size: int = 65536, prefetch: int = 2
311
+ ) -> "ddbc_bindings.ArrowStream": ...
312
+ # --- end RUST-PORT ---
313
+
314
+ # DB-API 2.0 Connection Object
315
+ # https://www.python.org/dev/peps/pep-0249/#connection-objects
316
+ class Connection:
317
+ """
318
+ Database connection object.
319
+
320
+ This class should not be instantiated directly. Use the connect() function instead.
321
+ """
322
+
323
+ # DB-API 2.0 Exception Attributes
324
+ Warning: type[Warning]
325
+ Error: type[Error]
326
+ InterfaceError: type[InterfaceError]
327
+ DatabaseError: type[DatabaseError]
328
+ DataError: type[DataError]
329
+ OperationalError: type[OperationalError]
330
+ IntegrityError: type[IntegrityError]
331
+ InternalError: type[InternalError]
332
+ ProgrammingError: type[ProgrammingError]
333
+ NotSupportedError: type[NotSupportedError]
334
+
335
+ # Connection Properties
336
+ @property
337
+ def timeout(self) -> int: ...
338
+ @timeout.setter
339
+ def timeout(self, value: int) -> None: ...
340
+ @property
341
+ def autocommit(self) -> bool: ...
342
+ @autocommit.setter
343
+ def autocommit(self, value: bool) -> None: ...
344
+ @property
345
+ def searchescape(self) -> str: ...
346
+ def __init__(
347
+ self,
348
+ connection_str: str = "",
349
+ autocommit: bool = False,
350
+ attrs_before: Optional[Dict[int, Union[int, str, bytes]]] = None,
351
+ timeout: int = 0,
352
+ native_uuid: Optional[bool] = None,
353
+ **kwargs: Any,
354
+ ) -> None: ...
355
+
356
+ # DB-API 2.0 Required Methods
357
+ def cursor(self) -> Cursor: ...
358
+ def commit(self) -> None: ...
359
+ def rollback(self) -> None: ...
360
+ def close(self) -> None: ...
361
+
362
+ # Extension Methods
363
+ def setautocommit(self, value: bool = False) -> None: ...
364
+ def setencoding(self, encoding: Optional[str] = None, ctype: Optional[int] = None) -> None: ...
365
+ def getencoding(self) -> Dict[str, Union[str, int]]: ...
366
+ def setdecoding(
367
+ self, sqltype: int, encoding: Optional[str] = None, ctype: Optional[int] = None
368
+ ) -> None: ...
369
+ def getdecoding(self, sqltype: int) -> Dict[str, Union[str, int]]: ...
370
+ def set_attr(self, attribute: int, value: Union[int, str, bytes, bytearray]) -> None: ...
371
+ def add_output_converter(
372
+ self, sqltype: Union[int, type], func: Callable[[Any], Any]
373
+ ) -> None: ...
374
+ def get_output_converter(self, sqltype: Union[int, type]) -> Optional[Callable[[Any], Any]]: ...
375
+ def remove_output_converter(self, sqltype: Union[int, type]) -> None: ...
376
+ def clear_output_converters(self) -> None: ...
377
+ def execute(self, sql: str, *args: Any) -> Cursor: ...
378
+ def batch_execute(
379
+ self,
380
+ statements: List[str],
381
+ params: Optional[List[Union[None, Any, Tuple[Any, ...], List[Any]]]] = None,
382
+ reuse_cursor: Optional[Cursor] = None,
383
+ auto_close: bool = False,
384
+ ) -> Tuple[List[Union[List[Row], int]], Cursor]: ...
385
+ def getinfo(self, info_type: int) -> Union[str, int, bool, None]: ...
386
+
387
+ # Context Manager Support
388
+ def __enter__(self) -> "Connection": ...
389
+ def __exit__(self, *args: Any) -> None: ...
390
+
391
+ # Module Connection Function
392
+ def connect(
393
+ connection_str: str = "",
394
+ autocommit: bool = False,
395
+ attrs_before: Optional[Dict[int, Union[int, str, bytes]]] = None,
396
+ timeout: int = 0,
397
+ native_uuid: Optional[bool] = None,
398
+ **kwargs: Any,
399
+ ) -> Connection: ...
400
+
401
+ # SQL Type Constants
402
+ SQL_CHAR: int
403
+ SQL_VARCHAR: int
404
+ SQL_LONGVARCHAR: int
405
+ SQL_WCHAR: int
406
+ SQL_WVARCHAR: int
407
+ SQL_WLONGVARCHAR: int
408
+ SQL_DECIMAL: int
409
+ SQL_NUMERIC: int
410
+ SQL_BIT: int
411
+ SQL_TINYINT: int
412
+ SQL_SMALLINT: int
413
+ SQL_INTEGER: int
414
+ SQL_BIGINT: int
415
+ SQL_REAL: int
416
+ SQL_FLOAT: int
417
+ SQL_DOUBLE: int
418
+ SQL_BINARY: int
419
+ SQL_VARBINARY: int
420
+ SQL_LONGVARBINARY: int
421
+ SQL_DATE: int
422
+ SQL_TIME: int
423
+ SQL_TIMESTAMP: int
424
+ # SQL Server-specific type constants (pyodbc parity)
425
+ SQL_SS_TIME2: int
426
+ SQL_SS_XML: int
427
+ SQL_SS_VARIANT: int
428
+ SQL_WMETADATA: int
429
+
430
+ # Connection Attribute Constants
431
+ SQL_ATTR_ACCESS_MODE: int
432
+ SQL_ATTR_CONNECTION_TIMEOUT: int
433
+ SQL_ATTR_CURRENT_CATALOG: int
434
+ SQL_ATTR_LOGIN_TIMEOUT: int
435
+ SQL_ATTR_PACKET_SIZE: int
436
+ SQL_ATTR_TXN_ISOLATION: int
437
+ SQL_TXN_ISOLATION_LEVEL: int
438
+
439
+ # Legacy Statement Options (not information types)
440
+ SQL_CONCURRENCY: int
441
+ SQL_ROWSET_SIZE: int
442
+ SQL_ROW_NUMBER: int
443
+
444
+ # Transaction Isolation Level Constants
445
+ SQL_TXN_READ_UNCOMMITTED: int
446
+ SQL_TXN_READ_COMMITTED: int
447
+ SQL_TXN_REPEATABLE_READ: int
448
+ SQL_TXN_SERIALIZABLE: int
449
+
450
+ # Access Mode Constants
451
+ SQL_MODE_READ_WRITE: int
452
+ SQL_MODE_READ_ONLY: int
453
+
454
+ # GetInfo Constants for Connection.getinfo()
455
+ SQL_DRIVER_NAME: int
456
+ SQL_DRIVER_VER: int
457
+ SQL_DRIVER_ODBC_VER: int
458
+ SQL_DRIVER_HLIB: int
459
+ SQL_DRIVER_HENV: int
460
+ SQL_DRIVER_HDBC: int
461
+ SQL_DATA_SOURCE_NAME: int
462
+ SQL_DATABASE_NAME: int
463
+ SQL_SERVER_NAME: int
464
+ SQL_USER_NAME: int
465
+ SQL_SQL_CONFORMANCE: int
466
+ SQL_KEYWORDS: int
467
+ SQL_IDENTIFIER_QUOTE_CHAR: int
468
+ SQL_SEARCH_PATTERN_ESCAPE: int
469
+ SQL_CATALOG_TERM: int
470
+ SQL_SCHEMA_TERM: int
471
+ SQL_TABLE_TERM: int
472
+ SQL_PROCEDURE_TERM: int
473
+ SQL_TXN_CAPABLE: int
474
+ SQL_DEFAULT_TXN_ISOLATION: int
475
+ SQL_NUMERIC_FUNCTIONS: int
476
+ SQL_STRING_FUNCTIONS: int
477
+ SQL_DATETIME_FUNCTIONS: int
478
+ SQL_TIMEDATE_FUNCTIONS: int
479
+ SQL_SYSTEM_FUNCTIONS: int
480
+ SQL_MAX_COLUMN_NAME_LEN: int
481
+ SQL_MAX_TABLE_NAME_LEN: int
482
+ SQL_MAX_SCHEMA_NAME_LEN: int
483
+ SQL_MAX_CATALOG_NAME_LEN: int
484
+ SQL_MAX_IDENTIFIER_LEN: int
485
+ SQL_CATALOG_NAME: int
486
+ SQL_DESCRIBE_PARAMETER: int
487
+ SQL_STATIC_CURSOR_ATTRIBUTES1: int
488
+ SQL_STATIC_CURSOR_ATTRIBUTES2: int
489
+ SQL_KEYSET_CURSOR_ATTRIBUTES1: int
490
+ SQL_KEYSET_CURSOR_ATTRIBUTES2: int
491
+ SQL_OJ_CAPABILITIES: int
492
+
493
+ # SQLGetInfo Return Values (not information types)
494
+ SQL_IC_UPPER: int
495
+ SQL_IC_LOWER: int
496
+ SQL_IC_SENSITIVE: int
497
+ SQL_IC_MIXED: int
498
+ SQL_SC_SQL92_ENTRY: int
499
+ SQL_SC_FIPS127_2_TRANSITIONAL: int
500
+ SQL_SC_SQL92_INTERMEDIATE: int
501
+ SQL_SC_SQL92_FULL: int
502
+
503
+ # Deprecated legacy values (127/128/129), not SQL conformance flags
504
+ SQL_SQL92_ENTRY_SQL: int
505
+ SQL_SQL92_INTERMEDIATE_SQL: int
506
+ SQL_SQL92_FULL_SQL: int
507
+
508
+ # ---------------------------------------------------------------------------
509
+ # RUST-PORT: APIs that do not exist in upstream mssql-python.
510
+ # Everything below is additive; upstream's declarations above are unchanged.
511
+ # ---------------------------------------------------------------------------
512
+
513
+ # Structural type for the token_provider= connect() keyword (also re-exported
514
+ # from upstream's mssql_python.connection).
515
+ class TokenProvider(Protocol):
516
+ def get_token(self, scope: str) -> Any: ...
517
+
518
+ # Partitioned parallel Arrow read. With partition_on (an integer column) and
519
+ # partitions > 1, the range is split and read over one connection each.
520
+ def read_arrow(
521
+ connection_str: str,
522
+ query: str,
523
+ partition_on: Optional[str] = None,
524
+ partitions: int = 1,
525
+ batch_size: int = 65536,
526
+ partition_bounds: Optional[Sequence[Any]] = None,
527
+ partition_nullable: Optional[bool] = None,
528
+ **connect_kwargs: Any,
529
+ ) -> "ddbc_bindings.ArrowTable": ...
530
+
531
+ class ParallelArrowStream:
532
+ @property
533
+ def column_names(self) -> List[str]: ...
534
+ @property
535
+ def num_columns(self) -> int: ...
536
+ @property
537
+ def closed(self) -> bool: ...
538
+ def __arrow_c_schema__(self) -> Any: ...
539
+ def __arrow_c_stream__(self, requested_schema: Optional[Any] = None) -> Any: ...
540
+ def read_all(self) -> "ddbc_bindings.ArrowTable": ...
541
+ def close(self) -> None: ...
542
+ def __enter__(self) -> "ParallelArrowStream": ...
543
+ def __exit__(self, *exc: Any) -> None: ...
544
+
545
+ # Like read_arrow, but a bounded, unordered stream (__arrow_c_stream__) fed by
546
+ # the partition workers while they read.
547
+ def read_arrow_stream(
548
+ connection_str: str,
549
+ query: str,
550
+ partition_on: Optional[str] = None,
551
+ partitions: int = 1,
552
+ batch_size: int = 65536,
553
+ partition_bounds: Optional[Sequence[Any]] = None,
554
+ max_buffered_batches: Optional[int] = None,
555
+ partition_nullable: Optional[bool] = None,
556
+ **connect_kwargs: Any,
557
+ ) -> ParallelArrowStream: ...
558
+
559
+ # Parallel Arrow bulk load. Returns rows_copied, batch_count, elapsed_time,
560
+ # rows_per_second and workers.
561
+ def write_arrow(
562
+ connection_str: str,
563
+ table: str,
564
+ source: Any,
565
+ workers: int = 4,
566
+ batch_size: int = 0,
567
+ table_lock: bool = True,
568
+ timeout: int = 30,
569
+ column_mappings: Optional[List[Any]] = None,
570
+ keep_identity: bool = False,
571
+ check_constraints: bool = False,
572
+ keep_nulls: bool = False,
573
+ fire_triggers: bool = False,
574
+ **connect_kwargs: Any,
575
+ ) -> Dict[str, Any]: ...
576
+
577
+ # connect() also accepts token_provider=<TokenProvider> and auth=<str> through
578
+ # its **kwargs. Native asyncio lives in the mssql_python.aio module
579
+ # (connect, create_pool, AsyncConnection, AsyncCursor, Pool); Unix only.