mssql-python 1.16.0__cp315-cp315-win_arm64.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.
@@ -0,0 +1,481 @@
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
+ )
20
+ import datetime
21
+ import logging
22
+ import pyarrow
23
+
24
+ # GLOBALS - DB-API 2.0 Required Module Globals
25
+ # https://www.python.org/dev/peps/pep-0249/#module-interface
26
+ apilevel: str # "2.0"
27
+ paramstyle: str # "qmark"
28
+ threadsafety: int # 1
29
+
30
+ # Module Settings - Properties that can be get/set at module level
31
+ lowercase: bool # Controls column name case behavior
32
+ native_uuid: bool # Controls UUID type handling
33
+ native_provider: Optional[str] # Selects the native ODBC provider ('msodbcsql18' or 'mssql-odbc')
34
+
35
+ # Settings Class
36
+ class Settings:
37
+ lowercase: bool
38
+ decimal_separator: str
39
+ native_uuid: bool
40
+ def __init__(self) -> None: ...
41
+
42
+ # Module-level Configuration Functions
43
+ def get_settings() -> Settings: ...
44
+ def setDecimalSeparator(separator: str) -> None: ...
45
+ def getDecimalSeparator() -> str: ...
46
+ def pooling(max_size: int = 100, idle_timeout: int = 600, enabled: bool = True) -> None: ...
47
+ def get_native_provider_info() -> Dict[str, object]: ...
48
+ def get_info_constants() -> Dict[str, int]: ...
49
+
50
+ # Logging Functions
51
+ def setup_logging(mode: str = "file", log_level: int = logging.DEBUG) -> None: ...
52
+ def get_logger() -> Optional[logging.Logger]: ...
53
+
54
+ # DB-API 2.0 Type Objects
55
+ # https://www.python.org/dev/peps/pep-0249/#type-objects
56
+ class STRING:
57
+ """Type object for string-based database columns (e.g. CHAR, VARCHAR)."""
58
+
59
+ ...
60
+
61
+ class BINARY:
62
+ """Type object for binary database columns (e.g. BINARY, VARBINARY)."""
63
+
64
+ ...
65
+
66
+ class NUMBER:
67
+ """Type object for numeric database columns (e.g. INT, DECIMAL)."""
68
+
69
+ ...
70
+
71
+ class DATETIME:
72
+ """Type object for date/time database columns (e.g. DATE, TIMESTAMP)."""
73
+
74
+ ...
75
+
76
+ class ROWID:
77
+ """Type object for row identifier columns."""
78
+
79
+ ...
80
+
81
+ # DB-API 2.0 Type Constructors
82
+ # https://www.python.org/dev/peps/pep-0249/#type-constructors
83
+ def Date(year: int, month: int, day: int) -> datetime.date: ...
84
+ def Time(hour: int, minute: int, second: int) -> datetime.time: ...
85
+ def Timestamp(
86
+ year: int,
87
+ month: int,
88
+ day: int,
89
+ hour: int,
90
+ minute: int,
91
+ second: int,
92
+ microsecond: int,
93
+ ) -> datetime.datetime: ...
94
+ def DateFromTicks(ticks: int) -> datetime.date: ...
95
+ def TimeFromTicks(ticks: int) -> datetime.time: ...
96
+ def TimestampFromTicks(ticks: int) -> datetime.datetime: ...
97
+ def Binary(value: Union[str, bytes, bytearray, memoryview]) -> bytes: ...
98
+
99
+ # DB-API 2.0 Exception Hierarchy
100
+ # https://www.python.org/dev/peps/pep-0249/#exceptions
101
+ class Warning(Exception):
102
+ def __init__(self, driver_error: str, ddbc_error: str) -> None: ...
103
+ driver_error: str
104
+ ddbc_error: str
105
+ message: str
106
+
107
+ class Error(Exception):
108
+ def __init__(self, driver_error: str, ddbc_error: str) -> None: ...
109
+ driver_error: str
110
+ ddbc_error: str
111
+ message: str
112
+
113
+ class InterfaceError(Error):
114
+ def __init__(self, driver_error: str, ddbc_error: str) -> None: ...
115
+
116
+ class DatabaseError(Error):
117
+ def __init__(self, driver_error: str, ddbc_error: str) -> None: ...
118
+
119
+ class DataError(DatabaseError):
120
+ def __init__(self, driver_error: str, ddbc_error: str) -> None: ...
121
+
122
+ class OperationalError(DatabaseError):
123
+ def __init__(self, driver_error: str, ddbc_error: str) -> None: ...
124
+
125
+ class IntegrityError(DatabaseError):
126
+ def __init__(self, driver_error: str, ddbc_error: str) -> None: ...
127
+
128
+ class InternalError(DatabaseError):
129
+ def __init__(self, driver_error: str, ddbc_error: str) -> None: ...
130
+
131
+ class ProgrammingError(DatabaseError):
132
+ def __init__(self, driver_error: str, ddbc_error: str) -> None: ...
133
+
134
+ class NotSupportedError(DatabaseError):
135
+ def __init__(self, driver_error: str, ddbc_error: str) -> None: ...
136
+
137
+ # Row Object
138
+ class Row:
139
+ """
140
+ Represents a database result row.
141
+
142
+ Supports both index-based and name-based column access.
143
+ """
144
+
145
+ def __init__(
146
+ self,
147
+ values: List[Any],
148
+ column_map: Dict[str, int],
149
+ cursor: Optional["Cursor"] = None,
150
+ converter_map: Optional[List[Any]] = None,
151
+ uuid_str_indices: Optional[Tuple[int, ...]] = None,
152
+ column_map_lower: Optional[Dict[str, int]] = None,
153
+ column_names: Optional[Tuple[str, ...]] = None,
154
+ ) -> None: ...
155
+ @property
156
+ def _mapping(self) -> "RowMapping": ...
157
+ def __getitem__(self, index: int) -> Any: ...
158
+ def __getattr__(self, name: str) -> Any: ...
159
+ def __eq__(self, other: Any) -> bool: ...
160
+ def __len__(self) -> int: ...
161
+ def __iter__(self) -> Iterator[Any]: ...
162
+ def __str__(self) -> str: ...
163
+ def __repr__(self) -> str: ...
164
+
165
+ class RowMapping(Mapping[str, Any]):
166
+ """Read-only mapping view (column name -> value) over a Row."""
167
+
168
+ def __init__(self, row: "Row") -> None: ...
169
+ def __getitem__(self, key: str) -> Any: ...
170
+ def __iter__(self) -> Iterator[str]: ...
171
+ def __len__(self) -> int: ...
172
+ def __repr__(self) -> str: ...
173
+
174
+ # DB-API 2.0 Cursor Object
175
+ # https://www.python.org/dev/peps/pep-0249/#cursor-objects
176
+ class Cursor:
177
+ """
178
+ Database cursor for executing SQL operations and fetching results.
179
+
180
+ This class should not be instantiated directly. Use Connection.cursor() instead.
181
+ """
182
+
183
+ # DB-API 2.0 Required Attributes
184
+ description: Optional[
185
+ List[
186
+ Tuple[
187
+ str,
188
+ Any,
189
+ Optional[int],
190
+ Optional[int],
191
+ Optional[int],
192
+ Optional[int],
193
+ Optional[bool],
194
+ ]
195
+ ]
196
+ ]
197
+ rowcount: int
198
+ arraysize: int
199
+
200
+ # Extension Attributes
201
+ closed: bool
202
+ messages: List[str]
203
+
204
+ @property
205
+ def rownumber(self) -> int: ...
206
+ @property
207
+ def connection(self) -> "Connection": ...
208
+ def __init__(self, connection: "Connection", timeout: int = 0) -> None: ...
209
+
210
+ # DB-API 2.0 Required Methods
211
+ def callproc(
212
+ self, procname: str, parameters: Optional[Sequence[Any]] = None
213
+ ) -> Optional[Sequence[Any]]: ...
214
+ def close(self) -> None: ...
215
+ def execute(
216
+ self,
217
+ operation: str,
218
+ *parameters: Any,
219
+ use_prepare: bool = True,
220
+ reset_cursor: bool = True,
221
+ ) -> "Cursor": ...
222
+ def executemany(
223
+ self,
224
+ operation: str,
225
+ seq_of_parameters: Union[Sequence[Sequence[Any]], Sequence[Mapping[str, Any]]],
226
+ ) -> None: ...
227
+ def fetchone(self) -> Optional[Row]: ...
228
+ def fetchmany(self, size: Optional[int] = None) -> List[Row]: ...
229
+ def fetchall(self) -> List[Row]: ...
230
+ def nextset(self) -> Optional[bool]: ...
231
+ def setinputsizes(self, sizes: List[Union[int, Tuple[Any, ...]]]) -> None: ...
232
+ def setoutputsize(self, size: int, column: Optional[int] = None) -> None: ...
233
+
234
+ # Arrow Extension Methods (requires pyarrow)
235
+ def arrow_batch(self, batch_size: int = 8192) -> pyarrow.RecordBatch: ...
236
+ def arrow(self, batch_size: int = 8192) -> pyarrow.Table: ...
237
+ def arrow_reader(self, batch_size: int = 8192) -> "_ArrowReader": ...
238
+
239
+ # pyarrow.RecordBatchReader-compatible wrapper returned by Cursor.arrow_reader.
240
+ # Not part of the DB-API 2.0 surface and not intended to be instantiated
241
+ # directly by users; declared here so the return type of arrow_reader is
242
+ # accurate for static type checkers. Attributes not listed here (e.g.
243
+ # ``read_all``, ``read_pandas``, ``cast``) are delegated at runtime to the
244
+ # wrapped ``pyarrow.RecordBatchReader`` via ``__getattr__``.
245
+ class _ArrowReader:
246
+ @property
247
+ def closed(self) -> bool: ...
248
+ @property
249
+ def schema(self) -> pyarrow.Schema: ...
250
+ def read_next_batch(self) -> pyarrow.RecordBatch: ...
251
+ def close(self) -> None: ...
252
+ def __arrow_c_stream__(self, requested_schema: Any = ...) -> Any: ...
253
+ def __iter__(self) -> "_ArrowReader": ...
254
+ def __next__(self) -> pyarrow.RecordBatch: ...
255
+ def __enter__(self) -> "_ArrowReader": ...
256
+ def __exit__(self, exc_type: Any, exc: Any, tb: Any) -> None: ...
257
+ def __getattr__(self, name: str) -> Any: ...
258
+
259
+ # Bulk Copy
260
+ def bulkcopy(
261
+ self,
262
+ table_name: str,
263
+ data: Iterable[Union[Tuple[Any, ...], Row]],
264
+ batch_size: int = 0,
265
+ timeout: int = 30,
266
+ column_mappings: Optional[Union[List[str], List[Tuple[int, str]]]] = None,
267
+ keep_identity: bool = False,
268
+ check_constraints: bool = False,
269
+ table_lock: bool = False,
270
+ keep_nulls: bool = False,
271
+ fire_triggers: bool = False,
272
+ use_internal_transaction: bool = False,
273
+ ) -> Dict[str, Any]: ...
274
+ def bulkcopy_arrow(
275
+ self,
276
+ table_name: str,
277
+ source: Any,
278
+ batch_size: int = 0,
279
+ timeout: int = 30,
280
+ column_mappings: Optional[Union[List[str], List[Tuple[int, str]]]] = None,
281
+ keep_identity: bool = False,
282
+ check_constraints: bool = False,
283
+ table_lock: bool = False,
284
+ keep_nulls: bool = False,
285
+ fire_triggers: bool = False,
286
+ use_internal_transaction: bool = False,
287
+ ) -> Dict[str, Any]: ...
288
+
289
+ # DB-API 2.0 Connection Object
290
+ # https://www.python.org/dev/peps/pep-0249/#connection-objects
291
+ class Connection:
292
+ """
293
+ Database connection object.
294
+
295
+ This class should not be instantiated directly. Use the connect() function instead.
296
+ """
297
+
298
+ # DB-API 2.0 Exception Attributes
299
+ Warning: type[Warning]
300
+ Error: type[Error]
301
+ InterfaceError: type[InterfaceError]
302
+ DatabaseError: type[DatabaseError]
303
+ DataError: type[DataError]
304
+ OperationalError: type[OperationalError]
305
+ IntegrityError: type[IntegrityError]
306
+ InternalError: type[InternalError]
307
+ ProgrammingError: type[ProgrammingError]
308
+ NotSupportedError: type[NotSupportedError]
309
+
310
+ # Connection Properties
311
+ @property
312
+ def timeout(self) -> int: ...
313
+ @timeout.setter
314
+ def timeout(self, value: int) -> None: ...
315
+ @property
316
+ def autocommit(self) -> bool: ...
317
+ @autocommit.setter
318
+ def autocommit(self, value: bool) -> None: ...
319
+ @property
320
+ def searchescape(self) -> str: ...
321
+ def __init__(
322
+ self,
323
+ connection_str: str = "",
324
+ autocommit: bool = False,
325
+ attrs_before: Optional[Dict[int, Union[int, str, bytes]]] = None,
326
+ timeout: int = 0,
327
+ native_uuid: Optional[bool] = None,
328
+ **kwargs: Any,
329
+ ) -> None: ...
330
+
331
+ # DB-API 2.0 Required Methods
332
+ def cursor(self) -> Cursor: ...
333
+ def commit(self) -> None: ...
334
+ def rollback(self) -> None: ...
335
+ def close(self) -> None: ...
336
+
337
+ # Extension Methods
338
+ def setautocommit(self, value: bool = False) -> None: ...
339
+ def setencoding(self, encoding: Optional[str] = None, ctype: Optional[int] = None) -> None: ...
340
+ def getencoding(self) -> Dict[str, Union[str, int]]: ...
341
+ def setdecoding(
342
+ self, sqltype: int, encoding: Optional[str] = None, ctype: Optional[int] = None
343
+ ) -> None: ...
344
+ def getdecoding(self, sqltype: int) -> Dict[str, Union[str, int]]: ...
345
+ def set_attr(self, attribute: int, value: Union[int, str, bytes, bytearray]) -> None: ...
346
+ def add_output_converter(
347
+ self, sqltype: Union[int, type], func: Callable[[Any], Any]
348
+ ) -> None: ...
349
+ def get_output_converter(self, sqltype: Union[int, type]) -> Optional[Callable[[Any], Any]]: ...
350
+ def remove_output_converter(self, sqltype: Union[int, type]) -> None: ...
351
+ def clear_output_converters(self) -> None: ...
352
+ def execute(self, sql: str, *args: Any) -> Cursor: ...
353
+ def batch_execute(
354
+ self,
355
+ statements: List[str],
356
+ params: Optional[List[Union[None, Any, Tuple[Any, ...], List[Any]]]] = None,
357
+ reuse_cursor: Optional[Cursor] = None,
358
+ auto_close: bool = False,
359
+ ) -> Tuple[List[Union[List[Row], int]], Cursor]: ...
360
+ def getinfo(self, info_type: int) -> Union[str, int, bool, None]: ...
361
+
362
+ # Context Manager Support
363
+ def __enter__(self) -> "Connection": ...
364
+ def __exit__(self, *args: Any) -> None: ...
365
+
366
+ # Module Connection Function
367
+ def connect(
368
+ connection_str: str = "",
369
+ autocommit: bool = False,
370
+ attrs_before: Optional[Dict[int, Union[int, str, bytes]]] = None,
371
+ timeout: int = 0,
372
+ native_uuid: Optional[bool] = None,
373
+ **kwargs: Any,
374
+ ) -> Connection: ...
375
+
376
+ # SQL Type Constants
377
+ SQL_CHAR: int
378
+ SQL_VARCHAR: int
379
+ SQL_LONGVARCHAR: int
380
+ SQL_WCHAR: int
381
+ SQL_WVARCHAR: int
382
+ SQL_WLONGVARCHAR: int
383
+ SQL_DECIMAL: int
384
+ SQL_NUMERIC: int
385
+ SQL_BIT: int
386
+ SQL_TINYINT: int
387
+ SQL_SMALLINT: int
388
+ SQL_INTEGER: int
389
+ SQL_BIGINT: int
390
+ SQL_REAL: int
391
+ SQL_FLOAT: int
392
+ SQL_DOUBLE: int
393
+ SQL_BINARY: int
394
+ SQL_VARBINARY: int
395
+ SQL_LONGVARBINARY: int
396
+ SQL_DATE: int
397
+ SQL_TIME: int
398
+ SQL_TIMESTAMP: int
399
+ # SQL Server-specific type constants (pyodbc parity)
400
+ SQL_SS_TIME2: int
401
+ SQL_SS_XML: int
402
+ SQL_SS_VARIANT: int
403
+ SQL_WMETADATA: int
404
+
405
+ # Connection Attribute Constants
406
+ SQL_ATTR_ACCESS_MODE: int
407
+ SQL_ATTR_CONNECTION_TIMEOUT: int
408
+ SQL_ATTR_CURRENT_CATALOG: int
409
+ SQL_ATTR_LOGIN_TIMEOUT: int
410
+ SQL_ATTR_PACKET_SIZE: int
411
+ SQL_ATTR_TXN_ISOLATION: int
412
+ SQL_TXN_ISOLATION_LEVEL: int
413
+
414
+ # Legacy Statement Options (not information types)
415
+ SQL_CONCURRENCY: int
416
+ SQL_ROWSET_SIZE: int
417
+ SQL_ROW_NUMBER: int
418
+
419
+ # Transaction Isolation Level Constants
420
+ SQL_TXN_READ_UNCOMMITTED: int
421
+ SQL_TXN_READ_COMMITTED: int
422
+ SQL_TXN_REPEATABLE_READ: int
423
+ SQL_TXN_SERIALIZABLE: int
424
+
425
+ # Access Mode Constants
426
+ SQL_MODE_READ_WRITE: int
427
+ SQL_MODE_READ_ONLY: int
428
+
429
+ # GetInfo Constants for Connection.getinfo()
430
+ SQL_DRIVER_NAME: int
431
+ SQL_DRIVER_VER: int
432
+ SQL_DRIVER_ODBC_VER: int
433
+ SQL_DRIVER_HLIB: int
434
+ SQL_DRIVER_HENV: int
435
+ SQL_DRIVER_HDBC: int
436
+ SQL_DATA_SOURCE_NAME: int
437
+ SQL_DATABASE_NAME: int
438
+ SQL_SERVER_NAME: int
439
+ SQL_USER_NAME: int
440
+ SQL_SQL_CONFORMANCE: int
441
+ SQL_KEYWORDS: int
442
+ SQL_IDENTIFIER_QUOTE_CHAR: int
443
+ SQL_SEARCH_PATTERN_ESCAPE: int
444
+ SQL_CATALOG_TERM: int
445
+ SQL_SCHEMA_TERM: int
446
+ SQL_TABLE_TERM: int
447
+ SQL_PROCEDURE_TERM: int
448
+ SQL_TXN_CAPABLE: int
449
+ SQL_DEFAULT_TXN_ISOLATION: int
450
+ SQL_NUMERIC_FUNCTIONS: int
451
+ SQL_STRING_FUNCTIONS: int
452
+ SQL_DATETIME_FUNCTIONS: int
453
+ SQL_TIMEDATE_FUNCTIONS: int
454
+ SQL_SYSTEM_FUNCTIONS: int
455
+ SQL_MAX_COLUMN_NAME_LEN: int
456
+ SQL_MAX_TABLE_NAME_LEN: int
457
+ SQL_MAX_SCHEMA_NAME_LEN: int
458
+ SQL_MAX_CATALOG_NAME_LEN: int
459
+ SQL_MAX_IDENTIFIER_LEN: int
460
+ SQL_CATALOG_NAME: int
461
+ SQL_DESCRIBE_PARAMETER: int
462
+ SQL_STATIC_CURSOR_ATTRIBUTES1: int
463
+ SQL_STATIC_CURSOR_ATTRIBUTES2: int
464
+ SQL_KEYSET_CURSOR_ATTRIBUTES1: int
465
+ SQL_KEYSET_CURSOR_ATTRIBUTES2: int
466
+ SQL_OJ_CAPABILITIES: int
467
+
468
+ # SQLGetInfo Return Values (not information types)
469
+ SQL_IC_UPPER: int
470
+ SQL_IC_LOWER: int
471
+ SQL_IC_SENSITIVE: int
472
+ SQL_IC_MIXED: int
473
+ SQL_SC_SQL92_ENTRY: int
474
+ SQL_SC_FIPS127_2_TRANSITIONAL: int
475
+ SQL_SC_SQL92_INTERMEDIATE: int
476
+ SQL_SC_SQL92_FULL: int
477
+
478
+ # Deprecated legacy values (127/128/129), not SQL conformance flags
479
+ SQL_SQL92_ENTRY_SQL: int
480
+ SQL_SQL92_INTERMEDIATE_SQL: int
481
+ SQL_SQL92_FULL_SQL: int
Binary file