devart-sqlserver-connector 1.4.0__cp315-cp315-win32.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.
- devart/sqlserver/__init__.py +25 -0
- devart/sqlserver/http/tunnel.php +743 -0
- devart/sqlserver/sqlalchemy/__init__.py +26 -0
- devart/sqlserver/sqlserver.cp315-win32.pyd +0 -0
- devart/sqlserver/sqlserver.pyi +402 -0
- devart_sqlserver_connector-1.4.0.dist-info/METADATA +144 -0
- devart_sqlserver_connector-1.4.0.dist-info/RECORD +10 -0
- devart_sqlserver_connector-1.4.0.dist-info/WHEEL +5 -0
- devart_sqlserver_connector-1.4.0.dist-info/licenses/LICENSE +85 -0
- devart_sqlserver_connector-1.4.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
from sqlalchemy.dialects import registry
|
|
4
|
+
from sqlalchemy.dialects.mssql.base import MSDialect
|
|
5
|
+
|
|
6
|
+
registry.register('devart.sqlserver', 'devart.sqlserver.sqlalchemy', 'DevartSqlServerDialect')
|
|
7
|
+
|
|
8
|
+
class DevartSqlServerDialect(MSDialect):
|
|
9
|
+
driver = "devart"
|
|
10
|
+
name = "sqlserver"
|
|
11
|
+
|
|
12
|
+
supports_statement_cache = False
|
|
13
|
+
default_paramstyle = "named"
|
|
14
|
+
|
|
15
|
+
@classmethod
|
|
16
|
+
def import_dbapi(cls):
|
|
17
|
+
import devart.sqlserver
|
|
18
|
+
return devart.sqlserver
|
|
19
|
+
|
|
20
|
+
def _get_server_version_info(self, connection):
|
|
21
|
+
vers = connection.exec_driver_sql("select @@version").scalar()
|
|
22
|
+
m = re.match(r"Microsoft .*? - (\d+)\.(\d+)\.(\d+)\.(\d+)", vers)
|
|
23
|
+
if m:
|
|
24
|
+
return tuple(int(x) for x in m.group(1, 2, 3, 4))
|
|
25
|
+
else:
|
|
26
|
+
return None
|
|
Binary file
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
from typing import Tuple, List, Optional, Any, Dict
|
|
2
|
+
import datetime
|
|
3
|
+
import array
|
|
4
|
+
|
|
5
|
+
class description(object):
|
|
6
|
+
"""
|
|
7
|
+
The description class describes a column in a rowset returned by the cursor.
|
|
8
|
+
"""
|
|
9
|
+
name: str
|
|
10
|
+
"""
|
|
11
|
+
The name of the column in the rowset.
|
|
12
|
+
"""
|
|
13
|
+
type_code: int
|
|
14
|
+
"""
|
|
15
|
+
The database type code that corresponds to the type of the column.
|
|
16
|
+
"""
|
|
17
|
+
display_size: int
|
|
18
|
+
"""
|
|
19
|
+
The actual length of the column in characters for a character column, `None` otherwise.
|
|
20
|
+
"""
|
|
21
|
+
internal_size: int
|
|
22
|
+
"""
|
|
23
|
+
The size in bytes used by the connector to store the column data.
|
|
24
|
+
"""
|
|
25
|
+
precision: int
|
|
26
|
+
"""
|
|
27
|
+
The total number of significant digits for a numeric column, `None` otherwise.
|
|
28
|
+
"""
|
|
29
|
+
scale: int
|
|
30
|
+
"""
|
|
31
|
+
The number of digits in the fractional part for a numeric column, `None` otherwise.
|
|
32
|
+
"""
|
|
33
|
+
null_ok: bool
|
|
34
|
+
"""
|
|
35
|
+
`Py_True` if the corresponding database column accepts `NULL` values, `Py_False` otherwise.
|
|
36
|
+
"""
|
|
37
|
+
...
|
|
38
|
+
|
|
39
|
+
class cursor(object):
|
|
40
|
+
"""
|
|
41
|
+
The `cursor` class represents a database cursor, which is used to manage
|
|
42
|
+
the context of fetch operations. This class provides methods for executing SQL
|
|
43
|
+
statements and operating rowsets. Cursors are created using the `cursor()`
|
|
44
|
+
connection method.
|
|
45
|
+
"""
|
|
46
|
+
connection: str
|
|
47
|
+
"""
|
|
48
|
+
A read-only attribute that specifies the `connection` object
|
|
49
|
+
to which the cursor belongs.
|
|
50
|
+
"""
|
|
51
|
+
arraysize: int
|
|
52
|
+
"""
|
|
53
|
+
A read/write attribute that specifies the number of rows to fetch at a time
|
|
54
|
+
with the `fetchmany()` method.
|
|
55
|
+
"""
|
|
56
|
+
description: Tuple[description]
|
|
57
|
+
"""
|
|
58
|
+
A read-only attribute that describes the columns in a rowset returned
|
|
59
|
+
by the cursor.
|
|
60
|
+
"""
|
|
61
|
+
rowcount: int
|
|
62
|
+
"""
|
|
63
|
+
A read-only attribute that specifies the number of rows that the last
|
|
64
|
+
`execute()` call produced by a `SELECT` statement or affected by `UPDATE` or
|
|
65
|
+
`INSERT` statements.
|
|
66
|
+
"""
|
|
67
|
+
rownumber: int
|
|
68
|
+
"""
|
|
69
|
+
A read-only attribute that specifies the current 0-based index of the cursor
|
|
70
|
+
in the result set.
|
|
71
|
+
"""
|
|
72
|
+
lastrowid: None
|
|
73
|
+
"""
|
|
74
|
+
This read-only attribute is provided for compatibility with the DB API 2.0
|
|
75
|
+
specification. It currently returns `None`.
|
|
76
|
+
"""
|
|
77
|
+
def setinputsizes(self, sizes: Optional[List[Any] | Tuple[Any]]) -> None:
|
|
78
|
+
"""
|
|
79
|
+
Defines parameter types for subsequent calls to the `execute*()` method.
|
|
80
|
+
"""
|
|
81
|
+
...
|
|
82
|
+
def execute(self, operation: str, parameters: Optional[List[Any] | Tuple[Any] | Dict[str, Any]]) -> cursor:
|
|
83
|
+
"""
|
|
84
|
+
Prepares and executes a database operation.
|
|
85
|
+
"""
|
|
86
|
+
...
|
|
87
|
+
def executemany(self, operation: str, parameters: Optional[List[Any] | Tuple[Any] | Dict[str, Any]]) -> cursor:
|
|
88
|
+
"""
|
|
89
|
+
Prepares and executes a batch database operation.
|
|
90
|
+
"""
|
|
91
|
+
def fetchone(self) -> Tuple[Any]:
|
|
92
|
+
"""
|
|
93
|
+
Fetches the next row of a query result set.
|
|
94
|
+
"""
|
|
95
|
+
...
|
|
96
|
+
def fetchmany(self, size: Optional[int]) -> List[Tuple[Any]]:
|
|
97
|
+
"""
|
|
98
|
+
Fetches the next set of rows of a query result.
|
|
99
|
+
"""
|
|
100
|
+
...
|
|
101
|
+
def fetchall(self) -> List[Tuple[Any]]:
|
|
102
|
+
"""
|
|
103
|
+
Fetches all remaining rows of a query result.
|
|
104
|
+
"""
|
|
105
|
+
...
|
|
106
|
+
def next(self) -> Tuple[Any]:
|
|
107
|
+
"""
|
|
108
|
+
Returns the next row from the currently executed SQL statement.
|
|
109
|
+
"""
|
|
110
|
+
...
|
|
111
|
+
def scroll(value: int, mode: Optional[str]) -> bool:
|
|
112
|
+
"""
|
|
113
|
+
Scrolls the cursor in the result set to a new position.
|
|
114
|
+
"""
|
|
115
|
+
...
|
|
116
|
+
def addtypecast(self, column: int | dbtype | str | description | Dict[str, type], python_type: Optional[type]) -> None:
|
|
117
|
+
"""
|
|
118
|
+
Defines a data type cast rule to use when fetching data from the cursor.
|
|
119
|
+
"""
|
|
120
|
+
...
|
|
121
|
+
def cleartypecast(self) -> None:
|
|
122
|
+
"""
|
|
123
|
+
Removes all data type cast rules defined for the cursor.
|
|
124
|
+
"""
|
|
125
|
+
...
|
|
126
|
+
def close(self) -> None:
|
|
127
|
+
"""
|
|
128
|
+
Closes the cursor.
|
|
129
|
+
"""
|
|
130
|
+
...
|
|
131
|
+
def setoutputsize(size: int, column: Optional[int]):
|
|
132
|
+
"""
|
|
133
|
+
This method is provided for compatibility with the DB API 2.0 specification.
|
|
134
|
+
It currently does nothing but is safe to call.
|
|
135
|
+
"""
|
|
136
|
+
...
|
|
137
|
+
|
|
138
|
+
class connection(object):
|
|
139
|
+
"""
|
|
140
|
+
The `connection` class encapsulates a database session. It provides methods
|
|
141
|
+
for creating cursors, type casting, and transaction handling. Connections
|
|
142
|
+
are created using the `connect()` module method.
|
|
143
|
+
"""
|
|
144
|
+
connectstring: str
|
|
145
|
+
"""
|
|
146
|
+
A read-only attribute that returns a string literal of the form
|
|
147
|
+
`"parameter=value;parameter=value"` that contains the parameters
|
|
148
|
+
for the current connection.
|
|
149
|
+
"""
|
|
150
|
+
def cursor(self) -> cursor:
|
|
151
|
+
"""
|
|
152
|
+
Creates a new cursor object, which is used to manage the context of fetch
|
|
153
|
+
operations.
|
|
154
|
+
"""
|
|
155
|
+
...
|
|
156
|
+
def close(self) -> None:
|
|
157
|
+
"""
|
|
158
|
+
Closes the connection.
|
|
159
|
+
"""
|
|
160
|
+
...
|
|
161
|
+
def commit(self) -> None:
|
|
162
|
+
"""
|
|
163
|
+
Commits any pending transaction to the database.
|
|
164
|
+
"""
|
|
165
|
+
...
|
|
166
|
+
def rollback(self) -> None:
|
|
167
|
+
"""
|
|
168
|
+
Causes the database to roll back any pending transaction.
|
|
169
|
+
"""
|
|
170
|
+
...
|
|
171
|
+
def addtypecast(self, column: int | dbtype | str | description | Dict[str, type], python_type: Optional[type]) -> None:
|
|
172
|
+
"""
|
|
173
|
+
Defines a data type cast rule to use when fetching data from the cursor.
|
|
174
|
+
"""
|
|
175
|
+
...
|
|
176
|
+
def cleartypecast(self) -> None:
|
|
177
|
+
"""
|
|
178
|
+
Removes all data type cast rules defined for the connection.
|
|
179
|
+
"""
|
|
180
|
+
...
|
|
181
|
+
|
|
182
|
+
class connection_pool(object):
|
|
183
|
+
"""
|
|
184
|
+
Description of the `connection_pool` class is not available yet.
|
|
185
|
+
"""
|
|
186
|
+
enabled: bool = False
|
|
187
|
+
"""
|
|
188
|
+
Description of the `enabled` attribute is not available yet.
|
|
189
|
+
"""
|
|
190
|
+
max_size: int = 1000
|
|
191
|
+
"""
|
|
192
|
+
Description of the `max_size` attribute is not available yet.
|
|
193
|
+
"""
|
|
194
|
+
min_size: int = 1000
|
|
195
|
+
"""
|
|
196
|
+
Description of the `min_size` attribute is not available yet.
|
|
197
|
+
"""
|
|
198
|
+
lifetime: int = 0
|
|
199
|
+
"""
|
|
200
|
+
Description of the `lifetime` attribute is not available yet.
|
|
201
|
+
"""
|
|
202
|
+
validate: bool = False
|
|
203
|
+
"""
|
|
204
|
+
Description of the `validate` attribute is not available yet.
|
|
205
|
+
"""
|
|
206
|
+
|
|
207
|
+
class Warning(Exception):
|
|
208
|
+
"""
|
|
209
|
+
This exception is raised for important warnings like data truncations while
|
|
210
|
+
inserting, etc. The `Warning` exception is a subclass of the Python
|
|
211
|
+
`Exception` class.
|
|
212
|
+
"""
|
|
213
|
+
...
|
|
214
|
+
|
|
215
|
+
class Error(Exception):
|
|
216
|
+
"""
|
|
217
|
+
This exception is the base class of all error exceptions. You can use
|
|
218
|
+
it to catch all errors with a single `except` statement. The `Error` exception
|
|
219
|
+
is a subclass of the Python `Exception` class.
|
|
220
|
+
"""
|
|
221
|
+
...
|
|
222
|
+
|
|
223
|
+
class InterfaceError(Error):
|
|
224
|
+
"""
|
|
225
|
+
This exception is raised for errors that are related to the database interface
|
|
226
|
+
rather than the database itself. The `InterfaceError` exception is a subclass
|
|
227
|
+
of `Error`.
|
|
228
|
+
"""
|
|
229
|
+
...
|
|
230
|
+
|
|
231
|
+
class DatabaseError(Error):
|
|
232
|
+
"""
|
|
233
|
+
This exception is raised for errors that are related to the database.
|
|
234
|
+
The `DatabaseError` exception is a subclass of `Error`.
|
|
235
|
+
"""
|
|
236
|
+
...
|
|
237
|
+
|
|
238
|
+
class DataError(DatabaseError):
|
|
239
|
+
"""
|
|
240
|
+
This exception is raised for errors caused by issues with the processed data
|
|
241
|
+
like division by zero, numeric value out of range, etc. The `DataError`
|
|
242
|
+
exception is a subclass of `DatabaseError`.
|
|
243
|
+
"""
|
|
244
|
+
...
|
|
245
|
+
|
|
246
|
+
class OperationalError(DatabaseError):
|
|
247
|
+
"""
|
|
248
|
+
This exception is raised for errors that are related to the database operation
|
|
249
|
+
and not necessarily under the control of the developer, for example,
|
|
250
|
+
an unexpected disconnect occurs, the data source name isn't found,
|
|
251
|
+
a transaction couldn't be processed, a memory allocation error occurred
|
|
252
|
+
during processing, etc. The OperationalError exception is a subclass
|
|
253
|
+
of `DatabaseError`.
|
|
254
|
+
"""
|
|
255
|
+
...
|
|
256
|
+
|
|
257
|
+
class IntegrityError(DatabaseError):
|
|
258
|
+
"""
|
|
259
|
+
This exception raised when the relational integrity of the database
|
|
260
|
+
is affected, for example, a foreign key check fails. The `IntegrityError`
|
|
261
|
+
exception is a subclass of `DatabaseError`.
|
|
262
|
+
"""
|
|
263
|
+
...
|
|
264
|
+
|
|
265
|
+
class InternalError(DatabaseError):
|
|
266
|
+
"""
|
|
267
|
+
This exception is raised when the database encounters an internal error,
|
|
268
|
+
for example, the cursor isn't valid anymore, the transaction is out of sync,
|
|
269
|
+
etc. The `InternalError` exception is a subclass of `DatabaseError`.
|
|
270
|
+
"""
|
|
271
|
+
...
|
|
272
|
+
|
|
273
|
+
class ProgrammingError(DatabaseError):
|
|
274
|
+
"""
|
|
275
|
+
This exception is raised for programming errors, for example, table not found
|
|
276
|
+
or already exists, syntax error in the SQL statement, wrong number
|
|
277
|
+
of parameters specified, etc. The `ProgrammingError` exception is a subclass
|
|
278
|
+
of `DatabaseError`.
|
|
279
|
+
"""
|
|
280
|
+
...
|
|
281
|
+
|
|
282
|
+
class NotSupportedError(DatabaseError):
|
|
283
|
+
"""
|
|
284
|
+
This exception is raised when a method or database API isn't supported
|
|
285
|
+
by the database, for example, requesting a `rollback()` on a connection
|
|
286
|
+
that doesn't support transactions or has transactions turned off.
|
|
287
|
+
The `NotSupportedError` exception is a subclass of `DatabaseError`.
|
|
288
|
+
"""
|
|
289
|
+
...
|
|
290
|
+
|
|
291
|
+
class binary(object):
|
|
292
|
+
"""
|
|
293
|
+
This type object describes an object that holds binary data. By default, this
|
|
294
|
+
type object is used to fetch BLOB-based columns from the cursor. You can also
|
|
295
|
+
create a `binary` object using the `Binary()` constructor.
|
|
296
|
+
"""
|
|
297
|
+
value: bytes
|
|
298
|
+
"""
|
|
299
|
+
A value of type `bytes` that represents binary data. This is a read/write attribute
|
|
300
|
+
that accepts values of type `str`, `bytes`, `bytearray`, `array.array`, and `binary`.
|
|
301
|
+
"""
|
|
302
|
+
|
|
303
|
+
class dbtype(object):
|
|
304
|
+
name: str
|
|
305
|
+
values: Dict[int, str]
|
|
306
|
+
|
|
307
|
+
apilevel: str = "2.0"
|
|
308
|
+
"""
|
|
309
|
+
Indicates the DB API level supported by the module. Returns a string value "2.0".
|
|
310
|
+
"""
|
|
311
|
+
|
|
312
|
+
threadsafety: int = 2
|
|
313
|
+
"""
|
|
314
|
+
Indicates the thread safety level of the module. Returns an integer value `2` that means
|
|
315
|
+
that threads may share the module and connections.
|
|
316
|
+
"""
|
|
317
|
+
|
|
318
|
+
paramstyle: str = "named"
|
|
319
|
+
"""
|
|
320
|
+
Indicates the type of parameter marker formatting expected by the module.
|
|
321
|
+
Returns a string value "named" that means that the module supports named style parameters,
|
|
322
|
+
for example, `...WHERE name=:name`.
|
|
323
|
+
"""
|
|
324
|
+
|
|
325
|
+
def connect(connection_string: str, **kwargs: Optional[Any]) -> connection:
|
|
326
|
+
"""
|
|
327
|
+
Creates a new connection to the database.
|
|
328
|
+
"""
|
|
329
|
+
...
|
|
330
|
+
|
|
331
|
+
def Date(year: int, month: int, day: int) -> datetime.date:
|
|
332
|
+
"""
|
|
333
|
+
Creates an object that holds a date value.
|
|
334
|
+
"""
|
|
335
|
+
...
|
|
336
|
+
|
|
337
|
+
def Time(hour: int, minute: int, second: int | float, timezone: Optional[datetime.tzinfo]) -> datetime.time:
|
|
338
|
+
"""
|
|
339
|
+
Creates an object that holds a time value.
|
|
340
|
+
"""
|
|
341
|
+
...
|
|
342
|
+
|
|
343
|
+
def Timestamp(year: int, month: int, day: int, hour: Optional[int], minute:Optional[int], second: Optional[int | float], timezone: Optional[datetime.tzinfo]) -> datetime.datetime:
|
|
344
|
+
"""
|
|
345
|
+
Creates an object that holds a timestamp value.
|
|
346
|
+
"""
|
|
347
|
+
...
|
|
348
|
+
|
|
349
|
+
def DateFromTicks(ticks: float) -> datetime.date:
|
|
350
|
+
"""
|
|
351
|
+
Creates an object that holds a date value from the given ticks value
|
|
352
|
+
(the number of seconds since the Unix epoch). For more information, see
|
|
353
|
+
the `time` module in the standard Python documentation.
|
|
354
|
+
"""
|
|
355
|
+
...
|
|
356
|
+
|
|
357
|
+
def TimeFromTicks(ticks: float) -> datetime.time:
|
|
358
|
+
"""
|
|
359
|
+
Creates an object that holds a time value from the given ticks value (number
|
|
360
|
+
of seconds since the Unix epoch). For more information, see the `time` module
|
|
361
|
+
in the standard Python documentation.
|
|
362
|
+
"""
|
|
363
|
+
...
|
|
364
|
+
|
|
365
|
+
def TimestampFromTicks(ticks: float) -> datetime.datetime:
|
|
366
|
+
"""
|
|
367
|
+
Creates an object that holds a timestamp value from the given ticks value
|
|
368
|
+
(number of seconds since the Unix epoch). For more information, see the `time`
|
|
369
|
+
module in the standard Python documentation.
|
|
370
|
+
"""
|
|
371
|
+
...
|
|
372
|
+
|
|
373
|
+
def Binary(value: str | bytes | bytearray | array.array) -> binary:
|
|
374
|
+
"""
|
|
375
|
+
Creates an object that holds binary data.
|
|
376
|
+
"""
|
|
377
|
+
...
|
|
378
|
+
|
|
379
|
+
STRING: dbtype
|
|
380
|
+
"""
|
|
381
|
+
This type object describes string-based columns in a database.
|
|
382
|
+
"""
|
|
383
|
+
|
|
384
|
+
BINARY: dbtype
|
|
385
|
+
"""
|
|
386
|
+
This type object describes binary columns in a database.
|
|
387
|
+
"""
|
|
388
|
+
|
|
389
|
+
NUMBER: dbtype
|
|
390
|
+
"""
|
|
391
|
+
This type object describes numeric columns in a database.
|
|
392
|
+
"""
|
|
393
|
+
|
|
394
|
+
DATETIME: dbtype
|
|
395
|
+
"""
|
|
396
|
+
This type object describes date/time columns in a database.
|
|
397
|
+
"""
|
|
398
|
+
|
|
399
|
+
ROWID: dbtype
|
|
400
|
+
"""
|
|
401
|
+
This type object describes the `row id` columns in a database.
|
|
402
|
+
"""
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: devart-sqlserver-connector
|
|
3
|
+
Version: 1.4.0
|
|
4
|
+
Summary: New level of functionality and performance in data access via Python
|
|
5
|
+
Home-page: https://devart.com
|
|
6
|
+
Author: Devart
|
|
7
|
+
Author-email: support@devart.com
|
|
8
|
+
License: Other/Proprietary License
|
|
9
|
+
Project-URL: Homepage, http://devart.com/python/sqlserver
|
|
10
|
+
Project-URL: Download, http://devart.com/python/sqlserver/download.html
|
|
11
|
+
Project-URL: History, http://devart.com/python/sqlserver/revision_history.html
|
|
12
|
+
Project-URL: License, https://www.devart.com/python/eula.html
|
|
13
|
+
Project-URL: Documentation, http://docs.devart.com/python/sqlserver/overview.htm
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Dynamic: author
|
|
18
|
+
Dynamic: author-email
|
|
19
|
+
Dynamic: description
|
|
20
|
+
Dynamic: description-content-type
|
|
21
|
+
Dynamic: home-page
|
|
22
|
+
Dynamic: license
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
Dynamic: project-url
|
|
25
|
+
Dynamic: requires-python
|
|
26
|
+
Dynamic: summary
|
|
27
|
+
|
|
28
|
+
# Python Connector for SQL Server #
|
|
29
|
+
|
|
30
|
+
Python Connector for SQL Server is a connectivity solution for accessing SQL
|
|
31
|
+
Server databases from Python applications. It fully implements the Python DB
|
|
32
|
+
API 2.0 specification. The connector is distributed as a wheel package
|
|
33
|
+
for Windows, macOS, and Linux.
|
|
34
|
+
|
|
35
|
+
Direct connection
|
|
36
|
+
|
|
37
|
+
The connector enables you to establish a direct connection to SQL Server from
|
|
38
|
+
a Python application via TCP/IP, eliminating the need for the database client
|
|
39
|
+
library. A direct connection increases the speed of data transmission between
|
|
40
|
+
the application and SQL Server database server. It also streamlines
|
|
41
|
+
the deployment process since you don't have to distribute any client
|
|
42
|
+
libraries with the application.
|
|
43
|
+
|
|
44
|
+
Secure communication
|
|
45
|
+
|
|
46
|
+
The connector supports encrypted communications using SSL/TLS, SSH tunneling,
|
|
47
|
+
and HTTP/HTTPS tunneling.
|
|
48
|
+
|
|
49
|
+
## Connecting ##
|
|
50
|
+
|
|
51
|
+
To establish a connection to a SQL Server database, import the connector and
|
|
52
|
+
use the `connect()` method with your connection parameters.
|
|
53
|
+
|
|
54
|
+
### Import the connector ###
|
|
55
|
+
|
|
56
|
+
First, import the SQL Server connector module:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
import devart.sqlserver
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Establish a connection ###
|
|
63
|
+
|
|
64
|
+
Connect to a database using the `connect()` module method and obtain a `connection` object.
|
|
65
|
+
|
|
66
|
+
You can connect using either mixed mode authentication and Windows authentication.
|
|
67
|
+
|
|
68
|
+
#### Mixed mode authentication ####
|
|
69
|
+
|
|
70
|
+
For mixed mode authentication, provide your server name, database, user ID, and password:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
my_connection = devart.sqlserver.connect("Authentication=Windows;Server=your_server;Database=your_database")
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Replace the example values with your actual server name, database, and database credentials.
|
|
77
|
+
|
|
78
|
+
#### Windows authentication ####
|
|
79
|
+
|
|
80
|
+
For Windows authentication, provide your server and database names. The connector will use your Windows account credentials:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
my_connection = devart.sqlserver.connect("Authentication=Windows;Server=your_server;Database=your_database")
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Replace the example values with your actual server and database names.
|
|
87
|
+
|
|
88
|
+
## Querying data ##
|
|
89
|
+
|
|
90
|
+
Once connected to SQL Server, you can execute SQL queries to retrieve data
|
|
91
|
+
from your SQL Server database.
|
|
92
|
+
|
|
93
|
+
### Execute a query ###
|
|
94
|
+
|
|
95
|
+
Create a `cursor` object using the `cursor()` connection method.
|
|
96
|
+
```
|
|
97
|
+
my_cursor = my_connection.cursor()
|
|
98
|
+
```
|
|
99
|
+
Execute a SQL query using the `execute()` cursor method.
|
|
100
|
+
```
|
|
101
|
+
my_cursor.execute("SELECT * FROM employees")
|
|
102
|
+
```
|
|
103
|
+
Retrieve results using one of the `fetch*()` methods.
|
|
104
|
+
```
|
|
105
|
+
for row in my_cursor.fetchall():
|
|
106
|
+
print(row)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Parameterized queries ###
|
|
110
|
+
|
|
111
|
+
You can use parameterized queries to pass variable values to your SQL statements. This allows you to reuse the same query with different data and helps to prevent SQL injection attacks.
|
|
112
|
+
|
|
113
|
+
Pass parameters as a list or tuple to the
|
|
114
|
+
|
|
115
|
+
`execute()`
|
|
116
|
+
|
|
117
|
+
method:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
query = "SELECT Id, Name FROM Contact WHERE Name = ? AND Email = ?"
|
|
121
|
+
params = ["Jordan Sanders", "jordansanders@example.com"]
|
|
122
|
+
my_cursor.execute(query, params)
|
|
123
|
+
results = my_cursor.fetchall()
|
|
124
|
+
for row in results:
|
|
125
|
+
print(row)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Each placeholder `?` in the query is replaced with a corresponding value from the parameter list.
|
|
129
|
+
|
|
130
|
+
## Ordering and activating the license ##
|
|
131
|
+
|
|
132
|
+
You can purchase a license for the connector on the ordering page:
|
|
133
|
+
https://www.devart.com/python/sqlserver/ordering.html
|
|
134
|
+
|
|
135
|
+
To activate the license, follow the instructions in the documentation:
|
|
136
|
+
https://docs.devart.com/python/sqlserver/activate-a-license.htm
|
|
137
|
+
|
|
138
|
+
## What's new ##
|
|
139
|
+
|
|
140
|
+
Python Connector for SQL Server 1.4
|
|
141
|
+
|
|
142
|
+
- Added support for Python 3.15
|
|
143
|
+
- Added support for SQL Server 2025
|
|
144
|
+
- Added support for Always Encrypted
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
devart/sqlserver/__init__.py,sha256=Mm85_zVYZhPUGpTHjapTlb-XU5dAH6IFET9Z9o4EaOI,967
|
|
2
|
+
devart/sqlserver/sqlserver.cp315-win32.pyd,sha256=D9mPRV71gJdn8Oc7BTIPlcDOBg1eA19ugjXFMrirKLs,1027480
|
|
3
|
+
devart/sqlserver/sqlserver.pyi,sha256=cOTOC8ysLQCQ22DK_z3SbJoChpcll44FIkYcJNpm6iY,12751
|
|
4
|
+
devart/sqlserver/http/tunnel.php,sha256=GNyjpPTJCyR86rvud4zgJzhzwhuCOCa-npKaFUYz9ZE,20815
|
|
5
|
+
devart/sqlserver/sqlalchemy/__init__.py,sha256=ITumLPj5NEOXutHq7G0mbWr8NMiLfdx8C3Zc4Bq0v_s,806
|
|
6
|
+
devart_sqlserver_connector-1.4.0.dist-info/licenses/LICENSE,sha256=_MWZL9M-P_10-SbCWgpuGvrm14CHdSgAdiESvdUAijI,8570
|
|
7
|
+
devart_sqlserver_connector-1.4.0.dist-info/METADATA,sha256=gwEeUye6HxH2FWeJZZRgjYlYUol6OVh50Dt6M24QpAI,4655
|
|
8
|
+
devart_sqlserver_connector-1.4.0.dist-info/WHEEL,sha256=0-HQ8elG8NSO7wBEaDBFSeg_-eqereljEkfhhJ5IAlY,97
|
|
9
|
+
devart_sqlserver_connector-1.4.0.dist-info/top_level.txt,sha256=h_mZcghGiX6pnc-Kb1EoAfIW2iHeDA0kJKfcLJMbq44,7
|
|
10
|
+
devart_sqlserver_connector-1.4.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Python Connector License Agreement
|
|
2
|
+
Copyright 2022-2026, Devart. All Rights Reserved
|
|
3
|
+
--------------------------------------------------
|
|
4
|
+
|
|
5
|
+
PLEASE READ THIS LICENSE AGREEMENT CAREFULLY. BY INSTALLING OR USING THIS SOFTWARE, YOU CONFIRM YOUR ACCEPTANCE OF AND AGREEMENT TO BE LEGALLY BOUND BY THE TERMS AND CONDITIONS OF THIS LICENSE. IF YOU DO NOT AGREE TO THE TERMS OF THIS LICENSE, DO NOT INSTALL OR USE THE SOFTWARE AND PROMPTLY RETURN IT TO DEVART.
|
|
6
|
+
|
|
7
|
+
INTRODUCTION
|
|
8
|
+
|
|
9
|
+
This Devart End-User License Agreement ("Agreement") is a legal agreement between you (either an individual person or a single legal entity) and Devart, governing the use of the Python Connector software application, including its source code, demos, intermediate files, printed materials, and online or electronic documentation contained within this installation file. For the purposes of this Agreement, the software program(s) and accompanying documentation will collectively be referred to as the "Software."
|
|
10
|
+
|
|
11
|
+
LICENSE
|
|
12
|
+
|
|
13
|
+
1. GRANT OF LICENSE
|
|
14
|
+
|
|
15
|
+
The enclosed Software is provided under a license, not sold. You are granted the following rights and privileges, subject to the limitations, restrictions, and terms outlined in this Agreement.
|
|
16
|
+
|
|
17
|
+
1.1. If you are a legally licensed user, your rights to use the Software are determined by the license type specified in the registration letter provided by Devart upon purchase. You are entitled to the following:
|
|
18
|
+
- Under the Single Developer License, you may install and use the Software on one or more computers, provided it is used exclusively by a single developer for developing, testing, and deploying applications in compliance with this Agreement.
|
|
19
|
+
- Under the Team License, you may install and use the Software on one or more computers, provided it is used by up to four (4) developers within a single company at one physical address, exclusively for developing, testing, and deploying applications in compliance with this Agreement.
|
|
20
|
+
- Under the Site License, you may install and use the Software on one or more computers, provided it is used by developers within a single company at one physical address, exclusively for developing, testing, and deploying applications in compliance with this Agreement.
|
|
21
|
+
- Under the OEM License, you may install and use the Software on one or more computers within a single company and deploy it as part of a licensee's application to web servers, application servers, batch servers, desktops, and other end-user devices. The OEM License allows the installation and use of the application containing the Software without incurring additional fees in favor of the licensor.
|
|
22
|
+
|
|
23
|
+
1.2. If you are a legally licensed user, your rights to use the Software depend on the License Type specified in the registration letter provided by Devart upon purchase:
|
|
24
|
+
- Under the Subscription-based License, you may install and use the Software on a single computer only for the duration of the subscription term specified at purchase. An Internet connection is required for license activation and status verification while using the Software. Once the subscription term expires, you must either discontinue using the Software or renew the license for a new subscription term.
|
|
25
|
+
- Under the Perpetual License, you may install and use a specific version of the Software on a single computer without requiring an active subscription. A subscription, if active, grants access to new product releases, regular updates, and support for new server versions during the subscription term.
|
|
26
|
+
|
|
27
|
+
1.3. If you are a legally licensed user of the Software, you are entitled to the following:
|
|
28
|
+
- Make one copy of the Software solely for archival purposes, or copy the Software onto the hard disk of your computer while retaining the original for archival purposes.
|
|
29
|
+
- Develop and test applications using the Software, subject to the limitations outlined below.
|
|
30
|
+
|
|
31
|
+
1.4. If you have the OEM License, you are also entitled to:
|
|
32
|
+
- Create and distribute multiple copies of the Software for deployment to end users.
|
|
33
|
+
- Deploy the Software to end users either as a standalone installation package or as an integrated component of your Applications.
|
|
34
|
+
|
|
35
|
+
1.5. You may use evaluation versions of the Software as outlined in the Evaluation section.
|
|
36
|
+
|
|
37
|
+
No additional rights or privileges are granted under this Agreement.
|
|
38
|
+
|
|
39
|
+
2. LIMITATIONS
|
|
40
|
+
|
|
41
|
+
The Software is licensed for use only by legally registered users, subject to the terms and conditions of this Agreement. The use of the Software is subject to the following restrictions:
|
|
42
|
+
|
|
43
|
+
2.1. You may not reverse engineer, decompile, or disassemble the Software.
|
|
44
|
+
|
|
45
|
+
2.2. You may not create or distribute any Python packages derived from the Software through inheritance for public distribution or commercial sale.
|
|
46
|
+
|
|
47
|
+
2.3. You may not reproduce or distribute any part of the Software documentation without explicit written permission from Devart.
|
|
48
|
+
|
|
49
|
+
2.4. You may not distribute or sell any portion of the Software without integrating it into your Applications.
|
|
50
|
+
|
|
51
|
+
2.5. You may not transfer, assign, or modify the Software, in whole or in part. The Software license is non-transferable, and the Software installation package may not be transferred.
|
|
52
|
+
|
|
53
|
+
2.6. You may not remove or modify any Devart copyright, trademark, or other proprietary rights notices contained in any part of Devart files.
|
|
54
|
+
|
|
55
|
+
3. REDISTRIBUTION
|
|
56
|
+
|
|
57
|
+
This license grants you a non-exclusive right to compile, reproduce, and distribute new software programs created using the Software. You cannot distribute the Software integrated into your Applications unless you are an OEM License holder. All Devart files remain the exclusive property of Devart.
|
|
58
|
+
|
|
59
|
+
4. TRANSFER
|
|
60
|
+
|
|
61
|
+
You may not transfer the Software to any individual or entity without express written permission from Devart. Specifically, you may not share copies of the Software under the Desktop Edition with other co-developers without obtaining a separate license for each individual.
|
|
62
|
+
|
|
63
|
+
5. TERMINATION
|
|
64
|
+
|
|
65
|
+
Devart reserves the right to terminate this Agreement immediately, without prior notice or judicial resolution, if any provision of the Agreement is violated. Upon termination, you must delete all copies of the Software, including any accompanying written materials.
|
|
66
|
+
|
|
67
|
+
6. EVALUATION
|
|
68
|
+
|
|
69
|
+
Devart may provide evaluation ("Trial") versions of the Software. You are permitted to transfer or distribute Trial versions only in their original installation package form. If the Software is marked as a "Trial" version, you may install and use it for up to 30 calendar days from the date of installation (the "Trial Period"). Use of the Trial version is strictly limited to evaluating the Software and is not permitted for developing or deploying applications in a production environment. Applications developed using Trial versions of the Software may not be used for any commercial purposes. Upon expiration of the Trial Period, you must uninstall the Software and destroy all copies, along with any accompanying documentation.
|
|
70
|
+
|
|
71
|
+
7. WARRANTY
|
|
72
|
+
|
|
73
|
+
The Software and accompanying documentation are provided "AS IS", without any warranty of any kind. Devart disclaims all warranties, whether express or implied, including but not limited to implied warranties of merchantability and fitness for a particular purpose or use.
|
|
74
|
+
|
|
75
|
+
8. SUBSCRIPTION AND SUPPORT
|
|
76
|
+
|
|
77
|
+
The Software is sold on a subscription basis. A subscription grants you the right to download updates, improvements, and enhancements from Devart's website as they become available during the active subscription period. The initial subscription period lasts for one year from the date of license purchase. Subscriptions are automatically activated upon purchase and can be renewed by Devart upon receipt of the applicable fees. Licensed users with an active subscription are entitled to request technical assistance for using the Software via email. Devart will make reasonable efforts to address your inquiries but does not guarantee that all issues or problems will be resolved or fixed.
|
|
78
|
+
|
|
79
|
+
Devart reserves the right to discontinue support for legacy versions of Python and databases.
|
|
80
|
+
|
|
81
|
+
9. COPYRIGHT
|
|
82
|
+
|
|
83
|
+
The Software is the confidential and proprietary copyrighted work of Devart and is protected by international copyright laws and treaty provisions. You may not remove or alter the copyright notice from any copy of the Software or its accompanying written materials.
|
|
84
|
+
|
|
85
|
+
This Agreement constitutes the entire understanding between the parties and supersedes any other agreements, whether written, oral, express, or implied.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
devart
|