pyodbc 5.2.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.
- pyodbc-5.2.0.dist-info/LICENSE.txt +9 -0
- pyodbc-5.2.0.dist-info/METADATA +55 -0
- pyodbc-5.2.0.dist-info/RECORD +7 -0
- pyodbc-5.2.0.dist-info/WHEEL +5 -0
- pyodbc-5.2.0.dist-info/top_level.txt +2 -0
- pyodbc.cp313-win_amd64.pyd +0 -0
- pyodbc.pyi +1010 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
2
|
+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
3
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
|
4
|
+
permit persons to whom the Software is furnished to do so.
|
|
5
|
+
|
|
6
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
7
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
|
8
|
+
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
9
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pyodbc
|
|
3
|
+
Version: 5.2.0
|
|
4
|
+
Summary: DB API module for ODBC
|
|
5
|
+
Home-page: https://github.com/mkleehammer/pyodbc
|
|
6
|
+
Author-email: Michael Kleehammer <michael@kleehammer.com>
|
|
7
|
+
Maintainer: Michael Kleehammer
|
|
8
|
+
Maintainer-email: Michael Kleehammer <michael@kleehammer.com>
|
|
9
|
+
License: MIT-0 License
|
|
10
|
+
Project-URL: Homepage, https://github.com/mkleehammer/pyodbc
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: System Administrators
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT No Attribution License (MIT-0)
|
|
15
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
16
|
+
Classifier: Operating System :: POSIX
|
|
17
|
+
Classifier: Programming Language :: Python
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Topic :: Database
|
|
20
|
+
Requires-Python: >=3.8
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE.txt
|
|
23
|
+
|
|
24
|
+
# pyodbc
|
|
25
|
+
|
|
26
|
+
[](https://ci.appveyor.com/project/mkleehammer/pyodbc)
|
|
27
|
+
[](https://github.com/mkleehammer/pyodbc/actions/workflows/ubuntu_build.yml)
|
|
28
|
+
[](https://pypi.org/project/pyodbc/)
|
|
29
|
+
|
|
30
|
+
pyodbc is an open source Python module that makes accessing ODBC databases simple. It
|
|
31
|
+
implements the [DB API 2.0](https://www.python.org/dev/peps/pep-0249) specification but is packed with even more Pythonic convenience.
|
|
32
|
+
|
|
33
|
+
The easiest way to install pyodbc is to use pip:
|
|
34
|
+
|
|
35
|
+
python -m pip install pyodbc
|
|
36
|
+
|
|
37
|
+
On Macs, you should probably install unixODBC first if you don't already have an ODBC
|
|
38
|
+
driver manager installed. For example, using the [homebrew](https://brew.sh/) package manager:
|
|
39
|
+
|
|
40
|
+
brew install unixodbc
|
|
41
|
+
python -m pip install pyodbc
|
|
42
|
+
|
|
43
|
+
Similarly, on Unix you should make sure you have an ODBC driver manager installed before
|
|
44
|
+
installing pyodbc. See the [docs](https://github.com/mkleehammer/pyodbc/wiki/Install)
|
|
45
|
+
for more information about how to do this on different Unix flavors. (On Windows, the
|
|
46
|
+
ODBC driver manager is built-in.)
|
|
47
|
+
|
|
48
|
+
Precompiled binary wheels are provided for multiple Python versions on most Windows, macOS,
|
|
49
|
+
and Linux platforms. On other platforms pyodbc will be built from the source code. Note,
|
|
50
|
+
pyodbc contains C++ extensions so you will need a suitable C++ compiler when building from
|
|
51
|
+
source. See the [docs](https://github.com/mkleehammer/pyodbc/wiki/Install) for details.
|
|
52
|
+
|
|
53
|
+
[Documentation](https://github.com/mkleehammer/pyodbc/wiki)
|
|
54
|
+
|
|
55
|
+
[Release Notes](https://github.com/mkleehammer/pyodbc/releases)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
pyodbc.cp313-win_amd64.pyd,sha256=KtWB4gndn6IosHyf05xnK-Wq-TEo0JwG89n_F1v-gC8,134656
|
|
2
|
+
pyodbc.pyi,sha256=IJnAOfHdt1XVFU81ccRQ0mWfGfCCu2m4g2pWMIGpntU,33683
|
|
3
|
+
pyodbc-5.2.0.dist-info/LICENSE.txt,sha256=mFnIV3DJG3hmsPdpyTjjbWTQJgFBtSm5R7Tq2WiD6rQ,868
|
|
4
|
+
pyodbc-5.2.0.dist-info/METADATA,sha256=x83-DW5Bj_AP7A0Yugq49R4CJZvNb_RCZngQUHek5Vg,2797
|
|
5
|
+
pyodbc-5.2.0.dist-info/WHEEL,sha256=WsITy9NjrxZo875xZQhJpU3vZUHVZRtNnEd5DMBQpxU,101
|
|
6
|
+
pyodbc-5.2.0.dist-info/top_level.txt,sha256=Rb69vS-SNN_Bfh99vX7eCcvEAJoyzowG3u4R7W36Flw,8
|
|
7
|
+
pyodbc-5.2.0.dist-info/RECORD,,
|
|
Binary file
|
pyodbc.pyi
ADDED
|
@@ -0,0 +1,1010 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from typing import (
|
|
3
|
+
Any, Callable, Dict, Final, Generator, Iterable, Iterator,
|
|
4
|
+
List, Optional, Sequence, Tuple, Union,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# SQLSetConnectAttr attributes
|
|
9
|
+
# ref: https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlsetconnectattr-function
|
|
10
|
+
SQL_ATTR_ACCESS_MODE: int
|
|
11
|
+
SQL_ATTR_AUTOCOMMIT: int
|
|
12
|
+
SQL_ATTR_CURRENT_CATALOG: int
|
|
13
|
+
SQL_ATTR_LOGIN_TIMEOUT: int
|
|
14
|
+
SQL_ATTR_ODBC_CURSORS: int
|
|
15
|
+
SQL_ATTR_QUIET_MODE: int
|
|
16
|
+
SQL_ATTR_TRACE: int
|
|
17
|
+
SQL_ATTR_TRACEFILE: int
|
|
18
|
+
SQL_ATTR_TRANSLATE_LIB: int
|
|
19
|
+
SQL_ATTR_TRANSLATE_OPTION: int
|
|
20
|
+
SQL_ATTR_TXN_ISOLATION: int
|
|
21
|
+
# other (e.g. specific to certain RDBMSs)
|
|
22
|
+
SQL_ACCESS_MODE: int
|
|
23
|
+
SQL_AUTOCOMMIT: int
|
|
24
|
+
SQL_CURRENT_QUALIFIER: int
|
|
25
|
+
SQL_LOGIN_TIMEOUT: int
|
|
26
|
+
SQL_ODBC_CURSORS: int
|
|
27
|
+
SQL_OPT_TRACE: int
|
|
28
|
+
SQL_OPT_TRACEFILE: int
|
|
29
|
+
SQL_PACKET_SIZE: int
|
|
30
|
+
SQL_QUIET_MODE: int
|
|
31
|
+
SQL_TRANSLATE_DLL: int
|
|
32
|
+
SQL_TRANSLATE_OPTION: int
|
|
33
|
+
SQL_TXN_ISOLATION: int
|
|
34
|
+
# Unicode
|
|
35
|
+
SQL_ATTR_ANSI_APP: int
|
|
36
|
+
|
|
37
|
+
# ODBC column data types
|
|
38
|
+
# https://docs.microsoft.com/en-us/sql/odbc/reference/appendixes/appendix-d-data-types
|
|
39
|
+
SQL_UNKNOWN_TYPE: int
|
|
40
|
+
SQL_CHAR: int
|
|
41
|
+
SQL_VARCHAR: int
|
|
42
|
+
SQL_LONGVARCHAR: int
|
|
43
|
+
SQL_WCHAR: int
|
|
44
|
+
SQL_WVARCHAR: int
|
|
45
|
+
SQL_WLONGVARCHAR: int
|
|
46
|
+
SQL_DECIMAL: int
|
|
47
|
+
SQL_NUMERIC: int
|
|
48
|
+
SQL_SMALLINT: int
|
|
49
|
+
SQL_INTEGER: int
|
|
50
|
+
SQL_REAL: int
|
|
51
|
+
SQL_FLOAT: int
|
|
52
|
+
SQL_DOUBLE: int
|
|
53
|
+
SQL_BIT: int
|
|
54
|
+
SQL_TINYINT: int
|
|
55
|
+
SQL_BIGINT: int
|
|
56
|
+
SQL_BINARY: int
|
|
57
|
+
SQL_VARBINARY: int
|
|
58
|
+
SQL_LONGVARBINARY: int
|
|
59
|
+
SQL_TYPE_DATE: int
|
|
60
|
+
SQL_TYPE_TIME: int
|
|
61
|
+
SQL_TYPE_TIMESTAMP: int
|
|
62
|
+
SQL_SS_TIME2: int
|
|
63
|
+
SQL_SS_VARIANT: int
|
|
64
|
+
SQL_SS_XML: int
|
|
65
|
+
SQL_INTERVAL_MONTH: int
|
|
66
|
+
SQL_INTERVAL_YEAR: int
|
|
67
|
+
SQL_INTERVAL_YEAR_TO_MONTH: int
|
|
68
|
+
SQL_INTERVAL_DAY: int
|
|
69
|
+
SQL_INTERVAL_HOUR: int
|
|
70
|
+
SQL_INTERVAL_MINUTE: int
|
|
71
|
+
SQL_INTERVAL_SECOND: int
|
|
72
|
+
SQL_INTERVAL_DAY_TO_HOUR: int
|
|
73
|
+
SQL_INTERVAL_DAY_TO_MINUTE: int
|
|
74
|
+
SQL_INTERVAL_DAY_TO_SECOND: int
|
|
75
|
+
SQL_INTERVAL_HOUR_TO_MINUTE: int
|
|
76
|
+
SQL_INTERVAL_HOUR_TO_SECOND: int
|
|
77
|
+
SQL_INTERVAL_MINUTE_TO_SECOND: int
|
|
78
|
+
SQL_GUID: int
|
|
79
|
+
# SQLDescribeCol
|
|
80
|
+
SQL_NO_NULLS: int
|
|
81
|
+
SQL_NULLABLE: int
|
|
82
|
+
SQL_NULLABLE_UNKNOWN: int
|
|
83
|
+
# specific to pyodbc
|
|
84
|
+
SQL_WMETADATA: int
|
|
85
|
+
|
|
86
|
+
# SQL_CONVERT_X
|
|
87
|
+
SQL_CONVERT_FUNCTIONS: int
|
|
88
|
+
SQL_CONVERT_BIGINT: int
|
|
89
|
+
SQL_CONVERT_BINARY: int
|
|
90
|
+
SQL_CONVERT_BIT: int
|
|
91
|
+
SQL_CONVERT_CHAR: int
|
|
92
|
+
SQL_CONVERT_DATE: int
|
|
93
|
+
SQL_CONVERT_DECIMAL: int
|
|
94
|
+
SQL_CONVERT_DOUBLE: int
|
|
95
|
+
SQL_CONVERT_FLOAT: int
|
|
96
|
+
SQL_CONVERT_GUID: int
|
|
97
|
+
SQL_CONVERT_INTEGER: int
|
|
98
|
+
SQL_CONVERT_INTERVAL_DAY_TIME: int
|
|
99
|
+
SQL_CONVERT_INTERVAL_YEAR_MONTH: int
|
|
100
|
+
SQL_CONVERT_LONGVARBINARY: int
|
|
101
|
+
SQL_CONVERT_LONGVARCHAR: int
|
|
102
|
+
SQL_CONVERT_NUMERIC: int
|
|
103
|
+
SQL_CONVERT_REAL: int
|
|
104
|
+
SQL_CONVERT_SMALLINT: int
|
|
105
|
+
SQL_CONVERT_TIME: int
|
|
106
|
+
SQL_CONVERT_TIMESTAMP: int
|
|
107
|
+
SQL_CONVERT_TINYINT: int
|
|
108
|
+
SQL_CONVERT_VARBINARY: int
|
|
109
|
+
SQL_CONVERT_VARCHAR: int
|
|
110
|
+
SQL_CONVERT_WCHAR: int
|
|
111
|
+
SQL_CONVERT_WLONGVARCHAR: int
|
|
112
|
+
SQL_CONVERT_WVARCHAR: int
|
|
113
|
+
|
|
114
|
+
# transaction isolation
|
|
115
|
+
# ref: https://docs.microsoft.com/en-us/sql/relational-databases/native-client-odbc-cursors/properties/cursor-transaction-isolation-level
|
|
116
|
+
SQL_TXN_READ_COMMITTED: int
|
|
117
|
+
SQL_TXN_READ_UNCOMMITTED: int
|
|
118
|
+
SQL_TXN_REPEATABLE_READ: int
|
|
119
|
+
SQL_TXN_SERIALIZABLE: int
|
|
120
|
+
|
|
121
|
+
# outer join capabilities
|
|
122
|
+
SQL_OJ_LEFT: int
|
|
123
|
+
SQL_OJ_RIGHT: int
|
|
124
|
+
SQL_OJ_FULL: int
|
|
125
|
+
SQL_OJ_NESTED: int
|
|
126
|
+
SQL_OJ_NOT_ORDERED: int
|
|
127
|
+
SQL_OJ_INNER: int
|
|
128
|
+
SQL_OJ_ALL_COMPARISON_OPS: int
|
|
129
|
+
|
|
130
|
+
# other ODBC database constants
|
|
131
|
+
SQL_SCOPE_CURROW: int
|
|
132
|
+
SQL_SCOPE_TRANSACTION: int
|
|
133
|
+
SQL_SCOPE_SESSION: int
|
|
134
|
+
SQL_PC_UNKNOWN: int
|
|
135
|
+
SQL_PC_NOT_PSEUDO: int
|
|
136
|
+
SQL_PC_PSEUDO: int
|
|
137
|
+
# SQL_INDEX_BTREE: int
|
|
138
|
+
# SQL_INDEX_CLUSTERED: int
|
|
139
|
+
# SQL_INDEX_CONTENT: int
|
|
140
|
+
# SQL_INDEX_HASHED: int
|
|
141
|
+
# SQL_INDEX_OTHER: int
|
|
142
|
+
|
|
143
|
+
# attributes for the ODBC SQLGetInfo function
|
|
144
|
+
# https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlgetinfo-function
|
|
145
|
+
SQL_ACCESSIBLE_PROCEDURES: int
|
|
146
|
+
SQL_ACCESSIBLE_TABLES: int
|
|
147
|
+
SQL_ACTIVE_ENVIRONMENTS: int
|
|
148
|
+
SQL_AGGREGATE_FUNCTIONS: int
|
|
149
|
+
SQL_ALTER_DOMAIN: int
|
|
150
|
+
SQL_ALTER_TABLE: int
|
|
151
|
+
SQL_ASYNC_MODE: int
|
|
152
|
+
SQL_BATCH_ROW_COUNT: int
|
|
153
|
+
SQL_BATCH_SUPPORT: int
|
|
154
|
+
SQL_BOOKMARK_PERSISTENCE: int
|
|
155
|
+
SQL_CATALOG_LOCATION: int
|
|
156
|
+
SQL_CATALOG_NAME: int
|
|
157
|
+
SQL_CATALOG_NAME_SEPARATOR: int
|
|
158
|
+
SQL_CATALOG_TERM: int
|
|
159
|
+
SQL_CATALOG_USAGE: int
|
|
160
|
+
SQL_COLLATION_SEQ: int
|
|
161
|
+
SQL_COLUMN_ALIAS: int
|
|
162
|
+
SQL_CONCAT_NULL_BEHAVIOR: int
|
|
163
|
+
SQL_CORRELATION_NAME: int
|
|
164
|
+
SQL_CREATE_ASSERTION: int
|
|
165
|
+
SQL_CREATE_CHARACTER_SET: int
|
|
166
|
+
SQL_CREATE_COLLATION: int
|
|
167
|
+
SQL_CREATE_DOMAIN: int
|
|
168
|
+
SQL_CREATE_SCHEMA: int
|
|
169
|
+
SQL_CREATE_TABLE: int
|
|
170
|
+
SQL_CREATE_TRANSLATION: int
|
|
171
|
+
SQL_CREATE_VIEW: int
|
|
172
|
+
SQL_CURSOR_COMMIT_BEHAVIOR: int
|
|
173
|
+
SQL_CURSOR_ROLLBACK_BEHAVIOR: int
|
|
174
|
+
# SQL_CURSOR_ROLLBACK_SQL_CURSOR_SENSITIVITY: int
|
|
175
|
+
SQL_DATABASE_NAME: int
|
|
176
|
+
SQL_DATA_SOURCE_NAME: int
|
|
177
|
+
SQL_DATA_SOURCE_READ_ONLY: int
|
|
178
|
+
SQL_DATETIME_LITERALS: int
|
|
179
|
+
SQL_DBMS_NAME: int
|
|
180
|
+
SQL_DBMS_VER: int
|
|
181
|
+
SQL_DDL_INDEX: int
|
|
182
|
+
SQL_DEFAULT_TXN_ISOLATION: int
|
|
183
|
+
SQL_DESCRIBE_PARAMETER: int
|
|
184
|
+
SQL_DM_VER: int
|
|
185
|
+
SQL_DRIVER_HDESC: int
|
|
186
|
+
SQL_DRIVER_HENV: int
|
|
187
|
+
SQL_DRIVER_HLIB: int
|
|
188
|
+
SQL_DRIVER_HSTMT: int
|
|
189
|
+
SQL_DRIVER_NAME: int
|
|
190
|
+
SQL_DRIVER_ODBC_VER: int
|
|
191
|
+
SQL_DRIVER_VER: int
|
|
192
|
+
SQL_DROP_ASSERTION: int
|
|
193
|
+
SQL_DROP_CHARACTER_SET: int
|
|
194
|
+
SQL_DROP_COLLATION: int
|
|
195
|
+
SQL_DROP_DOMAIN: int
|
|
196
|
+
SQL_DROP_SCHEMA: int
|
|
197
|
+
SQL_DROP_TABLE: int
|
|
198
|
+
SQL_DROP_TRANSLATION: int
|
|
199
|
+
SQL_DROP_VIEW: int
|
|
200
|
+
SQL_DYNAMIC_CURSOR_ATTRIBUTES1: int
|
|
201
|
+
SQL_DYNAMIC_CURSOR_ATTRIBUTES2: int
|
|
202
|
+
SQL_EXPRESSIONS_IN_ORDERBY: int
|
|
203
|
+
SQL_FILE_USAGE: int
|
|
204
|
+
SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1: int
|
|
205
|
+
SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2: int
|
|
206
|
+
SQL_GETDATA_EXTENSIONS: int
|
|
207
|
+
SQL_GROUP_BY: int
|
|
208
|
+
SQL_IDENTIFIER_CASE: int
|
|
209
|
+
SQL_IDENTIFIER_QUOTE_CHAR: int
|
|
210
|
+
SQL_INDEX_KEYWORDS: int
|
|
211
|
+
SQL_INFO_SCHEMA_VIEWS: int
|
|
212
|
+
SQL_INSERT_STATEMENT: int
|
|
213
|
+
SQL_INTEGRITY: int
|
|
214
|
+
SQL_KEYSET_CURSOR_ATTRIBUTES1: int
|
|
215
|
+
SQL_KEYSET_CURSOR_ATTRIBUTES2: int
|
|
216
|
+
SQL_KEYWORDS: int
|
|
217
|
+
SQL_LIKE_ESCAPE_CLAUSE: int
|
|
218
|
+
SQL_MAX_ASYNC_CONCURRENT_STATEMENTS: int
|
|
219
|
+
SQL_MAX_BINARY_LITERAL_LEN: int
|
|
220
|
+
SQL_MAX_CATALOG_NAME_LEN: int
|
|
221
|
+
SQL_MAX_CHAR_LITERAL_LEN: int
|
|
222
|
+
SQL_MAX_COLUMNS_IN_GROUP_BY: int
|
|
223
|
+
SQL_MAX_COLUMNS_IN_INDEX: int
|
|
224
|
+
SQL_MAX_COLUMNS_IN_ORDER_BY: int
|
|
225
|
+
SQL_MAX_COLUMNS_IN_SELECT: int
|
|
226
|
+
SQL_MAX_COLUMNS_IN_TABLE: int
|
|
227
|
+
SQL_MAX_COLUMN_NAME_LEN: int
|
|
228
|
+
SQL_MAX_CONCURRENT_ACTIVITIES: int
|
|
229
|
+
SQL_MAX_CURSOR_NAME_LEN: int
|
|
230
|
+
SQL_MAX_DRIVER_CONNECTIONS: int
|
|
231
|
+
SQL_MAX_IDENTIFIER_LEN: int
|
|
232
|
+
SQL_MAX_INDEX_SIZE: int
|
|
233
|
+
SQL_MAX_PROCEDURE_NAME_LEN: int
|
|
234
|
+
SQL_MAX_ROW_SIZE: int
|
|
235
|
+
SQL_MAX_ROW_SIZE_INCLUDES_LONG: int
|
|
236
|
+
SQL_MAX_SCHEMA_NAME_LEN: int
|
|
237
|
+
SQL_MAX_STATEMENT_LEN: int
|
|
238
|
+
SQL_MAX_TABLES_IN_SELECT: int
|
|
239
|
+
SQL_MAX_TABLE_NAME_LEN: int
|
|
240
|
+
SQL_MAX_USER_NAME_LEN: int
|
|
241
|
+
SQL_MULTIPLE_ACTIVE_TXN: int
|
|
242
|
+
SQL_MULT_RESULT_SETS: int
|
|
243
|
+
SQL_NEED_LONG_DATA_LEN: int
|
|
244
|
+
SQL_NON_NULLABLE_COLUMNS: int
|
|
245
|
+
SQL_NULL_COLLATION: int
|
|
246
|
+
SQL_NUMERIC_FUNCTIONS: int
|
|
247
|
+
SQL_ODBC_INTERFACE_CONFORMANCE: int
|
|
248
|
+
SQL_ODBC_VER: int
|
|
249
|
+
SQL_OJ_CAPABILITIES: int
|
|
250
|
+
SQL_ORDER_BY_COLUMNS_IN_SELECT: int
|
|
251
|
+
SQL_PARAM_ARRAY_ROW_COUNTS: int
|
|
252
|
+
SQL_PARAM_ARRAY_SELECTS: int
|
|
253
|
+
SQL_PARAM_TYPE_UNKNOWN: int
|
|
254
|
+
SQL_PARAM_INPUT: int
|
|
255
|
+
SQL_PARAM_INPUT_OUTPUT: int
|
|
256
|
+
SQL_PARAM_OUTPUT: int
|
|
257
|
+
SQL_RETURN_VALUE: int
|
|
258
|
+
SQL_RESULT_COL: int
|
|
259
|
+
SQL_PROCEDURES: int
|
|
260
|
+
SQL_PROCEDURE_TERM: int
|
|
261
|
+
SQL_QUOTED_IDENTIFIER_CASE: int
|
|
262
|
+
SQL_ROW_UPDATES: int
|
|
263
|
+
SQL_SCHEMA_TERM: int
|
|
264
|
+
SQL_SCHEMA_USAGE: int
|
|
265
|
+
SQL_SCROLL_OPTIONS: int
|
|
266
|
+
SQL_SEARCH_PATTERN_ESCAPE: int
|
|
267
|
+
SQL_SERVER_NAME: int
|
|
268
|
+
SQL_SPECIAL_CHARACTERS: int
|
|
269
|
+
SQL_SQL92_DATETIME_FUNCTIONS: int
|
|
270
|
+
SQL_SQL92_FOREIGN_KEY_DELETE_RULE: int
|
|
271
|
+
SQL_SQL92_FOREIGN_KEY_UPDATE_RULE: int
|
|
272
|
+
SQL_SQL92_GRANT: int
|
|
273
|
+
SQL_SQL92_NUMERIC_VALUE_FUNCTIONS: int
|
|
274
|
+
SQL_SQL92_PREDICATES: int
|
|
275
|
+
SQL_SQL92_RELATIONAL_JOIN_OPERATORS: int
|
|
276
|
+
SQL_SQL92_REVOKE: int
|
|
277
|
+
SQL_SQL92_ROW_VALUE_CONSTRUCTOR: int
|
|
278
|
+
SQL_SQL92_STRING_FUNCTIONS: int
|
|
279
|
+
SQL_SQL92_VALUE_EXPRESSIONS: int
|
|
280
|
+
SQL_SQL_CONFORMANCE: int
|
|
281
|
+
SQL_STANDARD_CLI_CONFORMANCE: int
|
|
282
|
+
SQL_STATIC_CURSOR_ATTRIBUTES1: int
|
|
283
|
+
SQL_STATIC_CURSOR_ATTRIBUTES2: int
|
|
284
|
+
SQL_STRING_FUNCTIONS: int
|
|
285
|
+
SQL_SUBQUERIES: int
|
|
286
|
+
SQL_SYSTEM_FUNCTIONS: int
|
|
287
|
+
SQL_TABLE_TERM: int
|
|
288
|
+
SQL_TIMEDATE_ADD_INTERVALS: int
|
|
289
|
+
SQL_TIMEDATE_DIFF_INTERVALS: int
|
|
290
|
+
SQL_TIMEDATE_FUNCTIONS: int
|
|
291
|
+
SQL_TXN_CAPABLE: int
|
|
292
|
+
SQL_TXN_ISOLATION_OPTION: int
|
|
293
|
+
SQL_UNION: int
|
|
294
|
+
SQL_USER_NAME: int
|
|
295
|
+
SQL_XOPEN_CLI_YEAR: int
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
# pyodbc-specific constants
|
|
299
|
+
BinaryNull: Any # to distinguish binary NULL values from char NULL values
|
|
300
|
+
SQLWCHAR_SIZE: int
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
# module attributes
|
|
304
|
+
# https://www.python.org/dev/peps/pep-0249/#globals
|
|
305
|
+
|
|
306
|
+
# read-only
|
|
307
|
+
apilevel: Final[str] = '2.0'
|
|
308
|
+
paramstyle: Final[str] = 'qmark'
|
|
309
|
+
threadsafety: Final[int] = 1
|
|
310
|
+
version: Final[str] # not pep-0249
|
|
311
|
+
|
|
312
|
+
# read-write (not pep-0249)
|
|
313
|
+
lowercase: bool = False
|
|
314
|
+
native_uuid: bool = False
|
|
315
|
+
odbcversion: str = '3.X'
|
|
316
|
+
pooling: bool = True
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
# exceptions
|
|
320
|
+
# https://www.python.org/dev/peps/pep-0249/#exceptions
|
|
321
|
+
class Warning(Exception): ...
|
|
322
|
+
class Error(Exception): ...
|
|
323
|
+
class InterfaceError(Error): ...
|
|
324
|
+
class DatabaseError(Error): ...
|
|
325
|
+
class DataError(DatabaseError): ...
|
|
326
|
+
class OperationalError(DatabaseError): ...
|
|
327
|
+
class IntegrityError(DatabaseError): ...
|
|
328
|
+
class InternalError(DatabaseError): ...
|
|
329
|
+
class ProgrammingError(DatabaseError): ...
|
|
330
|
+
class NotSupportedError(DatabaseError): ...
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
class Connection:
|
|
334
|
+
"""The ODBC connection class representing an ODBC connection to a database, for
|
|
335
|
+
managing database transactions and creating cursors.
|
|
336
|
+
https://www.python.org/dev/peps/pep-0249/#connection-objects
|
|
337
|
+
|
|
338
|
+
This class should not be instantiated directly, instead call pyodbc.connect() to
|
|
339
|
+
create a Connection object.
|
|
340
|
+
"""
|
|
341
|
+
|
|
342
|
+
@property
|
|
343
|
+
def autocommit(self) -> bool:
|
|
344
|
+
"""Whether the database automatically executes a commit after every successful transaction.
|
|
345
|
+
Default is False.
|
|
346
|
+
"""
|
|
347
|
+
...
|
|
348
|
+
|
|
349
|
+
@autocommit.setter
|
|
350
|
+
def autocommit(self, value: bool) -> None:
|
|
351
|
+
...
|
|
352
|
+
|
|
353
|
+
@property
|
|
354
|
+
def closed(self) -> bool:
|
|
355
|
+
"""Returns True if the connection is closed, False otherwise."""
|
|
356
|
+
...
|
|
357
|
+
|
|
358
|
+
@property
|
|
359
|
+
def maxwrite(self) -> int:
|
|
360
|
+
"""The maximum bytes to write before using SQLPutData, default is zero for no maximum."""
|
|
361
|
+
...
|
|
362
|
+
|
|
363
|
+
@maxwrite.setter
|
|
364
|
+
def maxwrite(self, value: int) -> None:
|
|
365
|
+
...
|
|
366
|
+
|
|
367
|
+
@property
|
|
368
|
+
def searchescape(self) -> str:
|
|
369
|
+
"""The character for escaping search pattern characters like "%" and "_".
|
|
370
|
+
This is typically the backslash character but can be driver-specific."""
|
|
371
|
+
...
|
|
372
|
+
|
|
373
|
+
@property
|
|
374
|
+
def timeout(self) -> int:
|
|
375
|
+
"""The timeout in seconds for SQL queries, use zero (the default) for no timeout limit."""
|
|
376
|
+
...
|
|
377
|
+
|
|
378
|
+
@timeout.setter
|
|
379
|
+
def timeout(self, value: int) -> None:
|
|
380
|
+
...
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
# implemented dunder methods
|
|
384
|
+
def __enter__(self) -> Connection: ...
|
|
385
|
+
def __exit__(self, exc_type, exc_value, traceback) -> None: ...
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
# functions for defining the text encoding used for data, metadata, sql, parameters, etc.
|
|
389
|
+
|
|
390
|
+
def setencoding(self,
|
|
391
|
+
encoding: Optional[str] = None,
|
|
392
|
+
ctype: Optional[int] = None) -> None:
|
|
393
|
+
"""Set the text encoding for SQL statements and textual parameters sent to the database.
|
|
394
|
+
|
|
395
|
+
Args:
|
|
396
|
+
encoding: Text encoding codec, e.g. "utf-8".
|
|
397
|
+
ctype: The C data type when passing data - either pyodbc.SQL_CHAR or pyodbc.SQL_WCHAR. More
|
|
398
|
+
relevant for Python 2.7.
|
|
399
|
+
"""
|
|
400
|
+
...
|
|
401
|
+
|
|
402
|
+
def setdecoding(self,
|
|
403
|
+
sqltype: int,
|
|
404
|
+
encoding: Optional[str] = None,
|
|
405
|
+
ctype: Optional[int] = None) -> None:
|
|
406
|
+
"""Set the text decoding used when reading SQL_CHAR or SQL_WCHAR data from the database.
|
|
407
|
+
|
|
408
|
+
Args:
|
|
409
|
+
sqltype: pyodbc.SQL_CHAR, pyodbc.SQL_WCHAR, or pyodbc.SQL_WMETADATA.
|
|
410
|
+
encoding: Text encoding codec, e.g. "utf-8".
|
|
411
|
+
ctype: The C data type to request from SQLGetData - either pyodbc.SQL_CHAR or
|
|
412
|
+
pyodbc.SQL_WCHAR. More relevant for Python 2.7.
|
|
413
|
+
"""
|
|
414
|
+
...
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
# functions for getting/setting connection attributes
|
|
418
|
+
|
|
419
|
+
def getinfo(self, infotype: int, /) -> Any:
|
|
420
|
+
"""Retrieve general information about the driver and the data source, via SQLGetInfo.
|
|
421
|
+
|
|
422
|
+
Args:
|
|
423
|
+
infotype: Id of the information to retrieve.
|
|
424
|
+
|
|
425
|
+
Returns:
|
|
426
|
+
The value of the requested information.
|
|
427
|
+
"""
|
|
428
|
+
...
|
|
429
|
+
|
|
430
|
+
def set_attr(self, attr_id: int, value: int, /) -> None:
|
|
431
|
+
"""Set an attribute on the connection, via SQLSetConnectAttr.
|
|
432
|
+
|
|
433
|
+
Args:
|
|
434
|
+
attr_id: Id for the attribute, as defined by ODBC or the driver.
|
|
435
|
+
value: The value of the attribute.
|
|
436
|
+
"""
|
|
437
|
+
...
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
# functions to handle non-standard database data types
|
|
441
|
+
|
|
442
|
+
def add_output_converter(self, sqltype: int, func: Optional[Callable], /) -> None:
|
|
443
|
+
"""Register an output converter function that will be called whenever a value
|
|
444
|
+
with the given SQL type is read from the database. See the Wiki for details:
|
|
445
|
+
https://github.com/mkleehammer/pyodbc/wiki/Using-an-Output-Converter-function
|
|
446
|
+
|
|
447
|
+
Args:
|
|
448
|
+
sqltype: The SQL type for the values to convert.
|
|
449
|
+
func: The converter function.
|
|
450
|
+
"""
|
|
451
|
+
...
|
|
452
|
+
|
|
453
|
+
def get_output_converter(self, sqltype: int, /) -> Optional[Callable]:
|
|
454
|
+
"""Retrieve the (previously registered) converter function for the SQL type.
|
|
455
|
+
|
|
456
|
+
Args:
|
|
457
|
+
sqltype: The SQL type.
|
|
458
|
+
|
|
459
|
+
Returns:
|
|
460
|
+
The converter function if it exists, None otherwise.
|
|
461
|
+
"""
|
|
462
|
+
...
|
|
463
|
+
|
|
464
|
+
def remove_output_converter(self, sqltype: int, /) -> None:
|
|
465
|
+
"""Delete a previously registered output converter function.
|
|
466
|
+
|
|
467
|
+
Args:
|
|
468
|
+
sqltype: The SQL type.
|
|
469
|
+
"""
|
|
470
|
+
...
|
|
471
|
+
|
|
472
|
+
def clear_output_converters(self) -> None:
|
|
473
|
+
"""Delete all previously registered converter functions."""
|
|
474
|
+
...
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
# functions for managing database transactions (in typical order of use)
|
|
478
|
+
|
|
479
|
+
def cursor(self) -> Cursor:
|
|
480
|
+
"""Create a new cursor on the connection.
|
|
481
|
+
|
|
482
|
+
Returns:
|
|
483
|
+
A new cursor.
|
|
484
|
+
"""
|
|
485
|
+
...
|
|
486
|
+
|
|
487
|
+
def execute(self, sql: str, *params: Any) -> Cursor:
|
|
488
|
+
"""A convenience function for running queries directly from a Connection object.
|
|
489
|
+
Creates a new cursor, runs the SQL query, and returns the new cursor.
|
|
490
|
+
|
|
491
|
+
Args:
|
|
492
|
+
sql: The SQL query.
|
|
493
|
+
*params: Any parameter values for the SQL query.
|
|
494
|
+
|
|
495
|
+
Returns:
|
|
496
|
+
A new cursor.
|
|
497
|
+
"""
|
|
498
|
+
...
|
|
499
|
+
|
|
500
|
+
def commit(self) -> None:
|
|
501
|
+
"""Commit all pending transactions since the last commit/rollback. This includes
|
|
502
|
+
all SQL statements executed from ALL cursors created on this connection."""
|
|
503
|
+
...
|
|
504
|
+
|
|
505
|
+
def rollback(self) -> None:
|
|
506
|
+
"""Rollback all pending transactions since the last commit/rollback. This includes
|
|
507
|
+
all SQL statements executed from ALL cursors created on this connection."""
|
|
508
|
+
...
|
|
509
|
+
|
|
510
|
+
def close(self) -> None:
|
|
511
|
+
"""Close the connection. Any uncommitted SQL statements will be rolled back."""
|
|
512
|
+
...
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
class Cursor:
|
|
516
|
+
"""The class representing database cursors. Cursors are vehicles for executing SQL
|
|
517
|
+
statements and returning their results.
|
|
518
|
+
https://www.python.org/dev/peps/pep-0249/#cursor-objects
|
|
519
|
+
|
|
520
|
+
This class should not be instantiated directly, instead call cursor() from a Connection
|
|
521
|
+
object to create a Cursor object.
|
|
522
|
+
"""
|
|
523
|
+
|
|
524
|
+
@property
|
|
525
|
+
def arraysize(self) -> int:
|
|
526
|
+
"""The number of rows at a time to fetch with fetchmany(), default is 1."""
|
|
527
|
+
...
|
|
528
|
+
|
|
529
|
+
@arraysize.setter
|
|
530
|
+
def arraysize(self, value: int) -> None:
|
|
531
|
+
...
|
|
532
|
+
|
|
533
|
+
@property
|
|
534
|
+
def connection(self) -> Connection:
|
|
535
|
+
"""The parent Connection object for the cursor."""
|
|
536
|
+
...
|
|
537
|
+
|
|
538
|
+
@property
|
|
539
|
+
def description(self) -> Tuple[Tuple[str, Any, int, int, int, int, bool]]:
|
|
540
|
+
"""The metadata for the columns returned in the last SQL SELECT statement, in
|
|
541
|
+
the form of a list of tuples. Each tuple contains seven fields:
|
|
542
|
+
|
|
543
|
+
0. name of the column (or column alias)
|
|
544
|
+
1. type code, the Python-equivalent class of the column, e.g. str for VARCHAR
|
|
545
|
+
2. display size (pyodbc does not set this value)
|
|
546
|
+
3. internal size (in bytes)
|
|
547
|
+
4. precision
|
|
548
|
+
5. scale
|
|
549
|
+
6. nullable (True/False)
|
|
550
|
+
|
|
551
|
+
ref: https://peps.python.org/pep-0249/#description
|
|
552
|
+
"""
|
|
553
|
+
...
|
|
554
|
+
|
|
555
|
+
@property
|
|
556
|
+
def fast_executemany(self) -> bool:
|
|
557
|
+
"""When this cursor property is False (the default), calls to executemany() do
|
|
558
|
+
nothing more than iterate over the provided list of parameters and calls execute()
|
|
559
|
+
on each set of parameters. This is typically slow. When fast_executemany is
|
|
560
|
+
True, the parameters are sent to the database in one bundle (with the SQL). This
|
|
561
|
+
is usually much faster, but there are limitations. Check the Wiki for details.
|
|
562
|
+
https://github.com/mkleehammer/pyodbc/wiki/Cursor#executemanysql-params-with-fast_executemanytrue
|
|
563
|
+
"""
|
|
564
|
+
...
|
|
565
|
+
|
|
566
|
+
@fast_executemany.setter
|
|
567
|
+
def fast_executemany(self, value: bool) -> None:
|
|
568
|
+
...
|
|
569
|
+
|
|
570
|
+
@property
|
|
571
|
+
def messages(self) -> Optional[List[Tuple[str, Union[str, bytes]]]]:
|
|
572
|
+
"""Any descriptive messages returned by the last call to execute(), e.g. PRINT
|
|
573
|
+
statements, or None."""
|
|
574
|
+
...
|
|
575
|
+
|
|
576
|
+
@property
|
|
577
|
+
def noscan(self) -> bool:
|
|
578
|
+
"""Whether the driver should scan SQL strings for escape sequences, default is True."""
|
|
579
|
+
...
|
|
580
|
+
|
|
581
|
+
@noscan.setter
|
|
582
|
+
def noscan(self, value: bool) -> None:
|
|
583
|
+
...
|
|
584
|
+
|
|
585
|
+
@property
|
|
586
|
+
def rowcount(self) -> int:
|
|
587
|
+
"""The number of rows modified by the last SQL statement. Has the value of -1
|
|
588
|
+
if the number of rows is unknown or unavailable.
|
|
589
|
+
"""
|
|
590
|
+
...
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
# implemented dunder methods
|
|
594
|
+
def __enter__(self) -> Cursor: ...
|
|
595
|
+
def __exit__(self, exc_type, exc_value, traceback) -> None: ...
|
|
596
|
+
def __iter__(self, /) -> Cursor: ...
|
|
597
|
+
def __next__(self, /) -> Row: ...
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
# functions for running SQL queries (in rough order of use)
|
|
601
|
+
|
|
602
|
+
def setinputsizes(self, sizes: Optional[Iterable[Tuple[int, int, int]]], /) -> None:
|
|
603
|
+
"""Explicitly declare the types and sizes of the parameters in a query. Set
|
|
604
|
+
to None to clear any previously registered input sizes.
|
|
605
|
+
|
|
606
|
+
Args:
|
|
607
|
+
sizes: A list of tuples, one tuple for each query parameter, where each
|
|
608
|
+
tuple contains:
|
|
609
|
+
|
|
610
|
+
1. the column datatype
|
|
611
|
+
2. the column size (char length or decimal precision)
|
|
612
|
+
3. the decimal scale.
|
|
613
|
+
|
|
614
|
+
For example: [(pyodbc.SQL_WVARCHAR, 50, 0), (pyodbc.SQL_DECIMAL, 18, 4)]
|
|
615
|
+
"""
|
|
616
|
+
...
|
|
617
|
+
|
|
618
|
+
def setoutputsize(self) -> None:
|
|
619
|
+
"""Not supported."""
|
|
620
|
+
...
|
|
621
|
+
|
|
622
|
+
def execute(self, sql: str, *params: Any) -> Cursor:
|
|
623
|
+
"""Run a SQL query and return the cursor.
|
|
624
|
+
|
|
625
|
+
Args:
|
|
626
|
+
sql: The SQL query.
|
|
627
|
+
*params: Any parameters for the SQL query, as positional arguments or a single iterable.
|
|
628
|
+
|
|
629
|
+
Returns:
|
|
630
|
+
The cursor, so that calls on the cursor can be chained.
|
|
631
|
+
"""
|
|
632
|
+
...
|
|
633
|
+
|
|
634
|
+
def executemany(self, sql: str, params: Union[Sequence, Iterator, Generator], /) -> None:
|
|
635
|
+
"""Run the SQL query against an iterable of parameters. The behavior of this
|
|
636
|
+
function depends heavily on the setting of the fast_executemany cursor property.
|
|
637
|
+
See the Wiki for details.
|
|
638
|
+
https://github.com/mkleehammer/pyodbc/wiki/Cursor#executemanysql-params-with-fast_executemanyfalse-the-default
|
|
639
|
+
https://github.com/mkleehammer/pyodbc/wiki/Cursor#executemanysql-params-with-fast_executemanytrue
|
|
640
|
+
|
|
641
|
+
Args:
|
|
642
|
+
sql: The SQL query.
|
|
643
|
+
*params: Any parameters for the SQL query, as an iterable of parameter sets.
|
|
644
|
+
"""
|
|
645
|
+
...
|
|
646
|
+
|
|
647
|
+
def fetchone(self) -> Optional[Row]:
|
|
648
|
+
"""Retrieve the next row in the current result set for the query.
|
|
649
|
+
|
|
650
|
+
Returns:
|
|
651
|
+
A row of results, or None if there is no more data to return.
|
|
652
|
+
"""
|
|
653
|
+
...
|
|
654
|
+
|
|
655
|
+
def fetchmany(self, size: int, /) -> List[Row]:
|
|
656
|
+
"""Retrieve the next rows in the current result set for the query, as a list.
|
|
657
|
+
|
|
658
|
+
Args:
|
|
659
|
+
size: The number of rows to return.
|
|
660
|
+
|
|
661
|
+
Returns:
|
|
662
|
+
A list of rows, or an empty list if there is no more data to return.
|
|
663
|
+
"""
|
|
664
|
+
...
|
|
665
|
+
|
|
666
|
+
def fetchall(self) -> List[Row]:
|
|
667
|
+
"""Retrieve all the remaining rows in the current result set for the query, as a list.
|
|
668
|
+
|
|
669
|
+
Returns:
|
|
670
|
+
A list of rows, or an empty list if there is no more data to return.
|
|
671
|
+
"""
|
|
672
|
+
...
|
|
673
|
+
|
|
674
|
+
def fetchval(self) -> Any:
|
|
675
|
+
"""A convenience function for returning the first column of the first row from
|
|
676
|
+
the query.
|
|
677
|
+
|
|
678
|
+
Returns:
|
|
679
|
+
The value in the first column of the first row, or None if there is no data.
|
|
680
|
+
"""
|
|
681
|
+
...
|
|
682
|
+
|
|
683
|
+
def skip(self, count: int, /) -> None:
|
|
684
|
+
"""Skip over rows in the current result set of a query.
|
|
685
|
+
|
|
686
|
+
Args:
|
|
687
|
+
count: The number of rows to skip.
|
|
688
|
+
"""
|
|
689
|
+
...
|
|
690
|
+
|
|
691
|
+
def nextset(self) -> bool:
|
|
692
|
+
"""Switch to the next result set in the SQL query (e.g. if there are
|
|
693
|
+
multiple SELECT statements in the SQL script).
|
|
694
|
+
|
|
695
|
+
Returns:
|
|
696
|
+
True if there are more result sets, False otherwise.
|
|
697
|
+
"""
|
|
698
|
+
...
|
|
699
|
+
|
|
700
|
+
def commit(self) -> None:
|
|
701
|
+
"""A convenience function for executing a commit on the parent connection.
|
|
702
|
+
Commits all pending transactions on the parent connection since the last
|
|
703
|
+
commit/rollback. This includes all SQL statements executed from ALL cursors
|
|
704
|
+
created on the parent connection, not just this cursor."""
|
|
705
|
+
...
|
|
706
|
+
|
|
707
|
+
def rollback(self) -> None:
|
|
708
|
+
"""A convenience function for executing a rollback on the parent connection.
|
|
709
|
+
Rolls back all pending transactions on the parent connection since the last
|
|
710
|
+
commit/rollback. This includes all SQL statements executed from ALL cursors
|
|
711
|
+
created on the parent connection, not just this cursor."""
|
|
712
|
+
...
|
|
713
|
+
|
|
714
|
+
def cancel(self) -> None:
|
|
715
|
+
"""Cancel the processing of the current query. Typically this has to be called
|
|
716
|
+
from a separate thread.
|
|
717
|
+
"""
|
|
718
|
+
...
|
|
719
|
+
|
|
720
|
+
def close(self) -> None:
|
|
721
|
+
"""Close the cursor, discarding any remaining result sets and/or messages."""
|
|
722
|
+
...
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
# functions to retrieve database metadata
|
|
726
|
+
|
|
727
|
+
def tables(self,
|
|
728
|
+
table: Optional[str] = None,
|
|
729
|
+
catalog: Optional[str] = None,
|
|
730
|
+
schema: Optional[str] = None,
|
|
731
|
+
tableType: Optional[str] = None) -> Cursor:
|
|
732
|
+
"""Return information about tables in the database, typically from the
|
|
733
|
+
INFORMATION_SCHEMA.TABLES metadata view. Parameter values can include
|
|
734
|
+
wildcard characters.
|
|
735
|
+
|
|
736
|
+
Args:
|
|
737
|
+
table: Name of the database table.
|
|
738
|
+
catalog: Name of the catalog (database).
|
|
739
|
+
schema: Name of the table schema.
|
|
740
|
+
tableType: Kind of table, e.g. "BASE TABLE".
|
|
741
|
+
|
|
742
|
+
Returns:
|
|
743
|
+
The cursor object, containing table information in the result set.
|
|
744
|
+
"""
|
|
745
|
+
...
|
|
746
|
+
|
|
747
|
+
def columns(self,
|
|
748
|
+
table: Optional[str] = None,
|
|
749
|
+
catalog: Optional[str] = None,
|
|
750
|
+
schema: Optional[str] = None,
|
|
751
|
+
column: Optional[str] = None) -> Cursor:
|
|
752
|
+
"""Return information about columns in database tables, typically from the
|
|
753
|
+
INFORMATION_SCHEMA.COLUMNS metadata view. Parameter values can include
|
|
754
|
+
wildcard characters.
|
|
755
|
+
|
|
756
|
+
Args:
|
|
757
|
+
table: Name of the database table.
|
|
758
|
+
catalog: Name of the catalog (database).
|
|
759
|
+
schema: Name of the table schema.
|
|
760
|
+
column: Name of the column in the table.
|
|
761
|
+
|
|
762
|
+
Returns:
|
|
763
|
+
The cursor object, containing column information in the result set.
|
|
764
|
+
"""
|
|
765
|
+
...
|
|
766
|
+
|
|
767
|
+
def statistics(self,
|
|
768
|
+
table: str,
|
|
769
|
+
catalog: Optional[str] = None,
|
|
770
|
+
schema: Optional[str] = None,
|
|
771
|
+
unique: bool = False,
|
|
772
|
+
quick: bool = True) -> Cursor:
|
|
773
|
+
"""Return statistical information about database tables. Parameter values
|
|
774
|
+
can include wildcard characters.
|
|
775
|
+
|
|
776
|
+
Args:
|
|
777
|
+
table: Name of the database table.
|
|
778
|
+
catalog: Name of the catalog (database).
|
|
779
|
+
schema: Name of the table schema.
|
|
780
|
+
unique: If True, include information about unique indexes only, not all indexes.
|
|
781
|
+
quick: If True, CARDINALITY and PAGES are returned only if they are readily
|
|
782
|
+
available, otherwise None is returned for them.
|
|
783
|
+
|
|
784
|
+
Returns:
|
|
785
|
+
The cursor object, containing statistical information in the result set.
|
|
786
|
+
"""
|
|
787
|
+
...
|
|
788
|
+
|
|
789
|
+
def rowIdColumns(self,
|
|
790
|
+
table: str,
|
|
791
|
+
catalog: Optional[str] = None,
|
|
792
|
+
schema: Optional[str] = None,
|
|
793
|
+
nullable: bool = True) -> Cursor:
|
|
794
|
+
"""Return the column(s) in a database table that uniquely identify each row
|
|
795
|
+
(e.g. the primary key column). Parameter values can include wildcard characters.
|
|
796
|
+
|
|
797
|
+
Args:
|
|
798
|
+
table: Name of the database table.
|
|
799
|
+
catalog: Name of the catalog (database).
|
|
800
|
+
schema: Name of the table schema.
|
|
801
|
+
nullable: If True, include sets of columns that are nullable.
|
|
802
|
+
|
|
803
|
+
Returns:
|
|
804
|
+
The cursor object, containing the relevant column information in the result set.
|
|
805
|
+
"""
|
|
806
|
+
...
|
|
807
|
+
|
|
808
|
+
def rowVerColumns(self,
|
|
809
|
+
table: str,
|
|
810
|
+
catalog: Optional[str] = None,
|
|
811
|
+
schema: Optional[str] = None,
|
|
812
|
+
nullable: bool = True) -> Cursor:
|
|
813
|
+
"""Return the column(s) in a database table that are updated whenever the row
|
|
814
|
+
is updated. Parameter values can include wildcard characters.
|
|
815
|
+
|
|
816
|
+
Args:
|
|
817
|
+
table: Name of the database table.
|
|
818
|
+
catalog: Name of the catalog (database).
|
|
819
|
+
schema: Name of the table schema.
|
|
820
|
+
nullable: If True, include sets of columns that are nullable.
|
|
821
|
+
|
|
822
|
+
Returns:
|
|
823
|
+
The cursor object, containing the relevant column information in the result set.
|
|
824
|
+
"""
|
|
825
|
+
...
|
|
826
|
+
|
|
827
|
+
def primaryKeys(self,
|
|
828
|
+
table: str,
|
|
829
|
+
catalog: Optional[str] = None,
|
|
830
|
+
schema: Optional[str] = None) -> Cursor:
|
|
831
|
+
"""Return the column(s) in a database table that make up the primary key on
|
|
832
|
+
the table. Parameter values can include wildcard characters.
|
|
833
|
+
|
|
834
|
+
Args:
|
|
835
|
+
table: Name of the database table.
|
|
836
|
+
catalog: Name of the catalog (database).
|
|
837
|
+
schema: Name of the table schema.
|
|
838
|
+
|
|
839
|
+
Returns:
|
|
840
|
+
The cursor object, containing primary key information in the result set.
|
|
841
|
+
"""
|
|
842
|
+
...
|
|
843
|
+
|
|
844
|
+
def foreignKeys(self,
|
|
845
|
+
table: Optional[str] = None,
|
|
846
|
+
catalog: Optional[str] = None,
|
|
847
|
+
schema: Optional[str] = None,
|
|
848
|
+
foreignTable: Optional[str] = None,
|
|
849
|
+
foreignCatalog: Optional[str] = None,
|
|
850
|
+
foreignSchema: Optional[str] = None) -> Cursor:
|
|
851
|
+
"""Return the foreign keys in a database table, i.e. any columns that refer to
|
|
852
|
+
primary key columns on another table. Parameter values can include wildcard characters.
|
|
853
|
+
|
|
854
|
+
Args:
|
|
855
|
+
table: Name of the database table.
|
|
856
|
+
catalog: Name of the catalog (database).
|
|
857
|
+
schema: Name of the table schema.
|
|
858
|
+
foreignTable: Name of the foreign database table.
|
|
859
|
+
foreignCatalog: Name of the foreign catalog (database).
|
|
860
|
+
foreignSchema: Name of the foreign table schema.
|
|
861
|
+
|
|
862
|
+
Returns:
|
|
863
|
+
The cursor object, containing foreign key information in the result set.
|
|
864
|
+
"""
|
|
865
|
+
...
|
|
866
|
+
|
|
867
|
+
def procedures(self,
|
|
868
|
+
procedure: Optional[str] = None,
|
|
869
|
+
catalog: Optional[str] = None,
|
|
870
|
+
schema: Optional[str] = None) -> Cursor:
|
|
871
|
+
"""Return information about stored procedures. Parameter values can include
|
|
872
|
+
wildcard characters.
|
|
873
|
+
|
|
874
|
+
Args:
|
|
875
|
+
procedure: Name of the stored procedure.
|
|
876
|
+
catalog: Name of the catalog (database).
|
|
877
|
+
schema: Name of the table schema.
|
|
878
|
+
|
|
879
|
+
Returns:
|
|
880
|
+
The cursor object, containing stored procedure information in the result set.
|
|
881
|
+
"""
|
|
882
|
+
...
|
|
883
|
+
|
|
884
|
+
def procedureColumns(self,
|
|
885
|
+
procedure: Optional[str] = None,
|
|
886
|
+
catalog: Optional[str] = None,
|
|
887
|
+
schema: Optional[str] = None) -> Cursor:
|
|
888
|
+
"""Return information about the columns used as input/output parameters in
|
|
889
|
+
stored procedures. Parameter values can include wildcard characters.
|
|
890
|
+
|
|
891
|
+
Args:
|
|
892
|
+
procedure: Name of the stored procedure.
|
|
893
|
+
catalog: Name of the catalog (database).
|
|
894
|
+
schema: Name of the table schema.
|
|
895
|
+
|
|
896
|
+
Returns:
|
|
897
|
+
The cursor object, containing stored procedure column information in the result set.
|
|
898
|
+
"""
|
|
899
|
+
...
|
|
900
|
+
|
|
901
|
+
def getTypeInfo(self, sqlType: Optional[int] = None, /) -> Cursor:
|
|
902
|
+
"""Return information about data types supported by the data source.
|
|
903
|
+
|
|
904
|
+
Args:
|
|
905
|
+
sqlType: The SQL data type.
|
|
906
|
+
|
|
907
|
+
Returns:
|
|
908
|
+
The cursor object, containing information about the SQL data type in the result set.
|
|
909
|
+
"""
|
|
910
|
+
...
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
class Row:
|
|
914
|
+
"""The class representing a single record in the result set from a query. Objects of
|
|
915
|
+
this class behave somewhat similarly to a NamedTuple. Column values can be accessed
|
|
916
|
+
by column name (i.e. using dot notation) or by row index.
|
|
917
|
+
"""
|
|
918
|
+
|
|
919
|
+
@property
|
|
920
|
+
def cursor_description(self) -> Tuple[Tuple[str, Any, int, int, int, int, bool]]:
|
|
921
|
+
"""The metadata for the columns in this Row, as retrieved from the parent Cursor object."""
|
|
922
|
+
...
|
|
923
|
+
|
|
924
|
+
# implemented dunder methods
|
|
925
|
+
def __contains__(self, key, /) -> int: ...
|
|
926
|
+
def __delattr__(self, name, /) -> None: ...
|
|
927
|
+
def __delitem__(self, key, /) -> None: ...
|
|
928
|
+
def __eq__(self, value, /) -> bool: ...
|
|
929
|
+
def __ge__(self, value, /) -> bool: ...
|
|
930
|
+
def __getattribute__(self, name, /) -> Any: ...
|
|
931
|
+
def __getitem__(self, key, /) -> Any: ...
|
|
932
|
+
def __gt__(self, value, /) -> bool: ...
|
|
933
|
+
def __iter__(self) -> Iterator[Any]: ...
|
|
934
|
+
def __le__(self, value, /) -> bool: ...
|
|
935
|
+
def __len__(self, /) -> int: ...
|
|
936
|
+
def __lt__(self, value, /) -> bool: ...
|
|
937
|
+
def __ne__(self, value, /) -> bool: ...
|
|
938
|
+
def __reduce__(self) -> Any: ...
|
|
939
|
+
def __repr__(self, /) -> str: ...
|
|
940
|
+
def __setattr__(self, name, value, /) -> None: ...
|
|
941
|
+
def __setitem__(self, key, value, /) -> None: ...
|
|
942
|
+
|
|
943
|
+
|
|
944
|
+
# module functions
|
|
945
|
+
|
|
946
|
+
def dataSources() -> Dict[str, str]:
|
|
947
|
+
"""Return all available Data Source Names (DSNs), typically from the odbcinst.ini file
|
|
948
|
+
or the Windows ODBC Data Source Administrator.
|
|
949
|
+
|
|
950
|
+
Returns:
|
|
951
|
+
A dictionary of DSNs and their textual descriptions.
|
|
952
|
+
"""
|
|
953
|
+
...
|
|
954
|
+
|
|
955
|
+
def drivers() -> List[str]:
|
|
956
|
+
"""Return the names of all available ODBC drivers, typically from the odbc.ini file or the
|
|
957
|
+
Windows ODBC Data Source Administrator.
|
|
958
|
+
|
|
959
|
+
Returns:
|
|
960
|
+
A list of driver names.
|
|
961
|
+
"""
|
|
962
|
+
...
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
def getDecimalSeparator() -> str:
|
|
966
|
+
"""Retrieve the decimal separator character used when parsing NUMERIC/DECIMAL values
|
|
967
|
+
from the database, e.g. the "." in "1,234.56".
|
|
968
|
+
|
|
969
|
+
Returns:
|
|
970
|
+
The decimal separator character.
|
|
971
|
+
"""
|
|
972
|
+
...
|
|
973
|
+
|
|
974
|
+
|
|
975
|
+
def setDecimalSeparator(sep: str, /) -> None:
|
|
976
|
+
"""Set the decimal separator character used when parsing NUMERIC/DECIMAL values
|
|
977
|
+
from the database, e.g. the "." in "1,234.56".
|
|
978
|
+
|
|
979
|
+
Args:
|
|
980
|
+
sep: The decimal separator character.
|
|
981
|
+
"""
|
|
982
|
+
...
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
def connect(connstring: Optional[str] = None,
|
|
986
|
+
/, *, # only positional parameters before, only named parameters after
|
|
987
|
+
autocommit: bool = False,
|
|
988
|
+
encoding: str = 'utf-16le',
|
|
989
|
+
readonly: bool = False,
|
|
990
|
+
timeout: int = 0,
|
|
991
|
+
attrs_before: Optional[Dict[int, Union[int, bytes, bytearray, str, Sequence[str]]]] = None,
|
|
992
|
+
**kwargs: Any) -> Connection:
|
|
993
|
+
"""Create a new ODBC connection to a database. See the Wiki for details:
|
|
994
|
+
https://github.com/mkleehammer/pyodbc/wiki/The-pyodbc-Module#connect
|
|
995
|
+
|
|
996
|
+
Args:
|
|
997
|
+
connstring: The connection string, which is passed verbatim to the driver manager.
|
|
998
|
+
autocommit: If True, instructs the database to commit after each SQL statement.
|
|
999
|
+
encoding: Encoding codec used when sending textual connection parameters to the database.
|
|
1000
|
+
readonly: To set the connection read-only. Not all drivers and/or databases support this.
|
|
1001
|
+
timeout: Set the connection timeout, in seconds. This is managed by the driver, not
|
|
1002
|
+
pyodbc, and not all drivers support this.
|
|
1003
|
+
attrs_before: Set low-level connection attributes before a connection is attempted.
|
|
1004
|
+
**kwargs: These key/value pairs are used to construct the connection string, or add
|
|
1005
|
+
to it (as "key=value;" combinations).
|
|
1006
|
+
|
|
1007
|
+
Returns:
|
|
1008
|
+
A new Connection object.
|
|
1009
|
+
"""
|
|
1010
|
+
...
|