python-tds
Advanced tools
+6
-5
| Metadata-Version: 2.1 | ||
| Name: python-tds | ||
| Version: 1.15.0 | ||
| Version: 1.16.0 | ||
| Summary: Python DBAPI driver for MSSQL using pure Python TDS (Tabular Data Stream) protocol implementation | ||
@@ -11,6 +11,7 @@ Home-page: https://github.com/denisenkom/pytds | ||
| Classifier: Programming Language :: Python | ||
| Classifier: Programming Language :: Python :: 2.7 | ||
| Classifier: Programming Language :: Python :: 3.3 | ||
| Classifier: Programming Language :: Python :: 3.4 | ||
| Classifier: Programming Language :: Python :: 3.5 | ||
| Classifier: Programming Language :: Python :: 3.8 | ||
| Classifier: Programming Language :: Python :: 3.9 | ||
| Classifier: Programming Language :: Python :: 3.10 | ||
| Classifier: Programming Language :: Python :: 3.11 | ||
| Classifier: Programming Language :: Python :: 3.12 | ||
| License-File: LICENSE.txt |
+5
-4
@@ -25,6 +25,7 @@ import os | ||
| "Programming Language :: Python", | ||
| "Programming Language :: Python :: 2.7", | ||
| "Programming Language :: Python :: 3.3", | ||
| "Programming Language :: Python :: 3.4", | ||
| "Programming Language :: Python :: 3.5", | ||
| "Programming Language :: Python :: 3.8", | ||
| "Programming Language :: Python :: 3.9", | ||
| "Programming Language :: Python :: 3.10", | ||
| "Programming Language :: Python :: 3.11", | ||
| "Programming Language :: Python :: 3.12", | ||
| ], | ||
@@ -31,0 +32,0 @@ zip_safe=True, |
+11
-18
@@ -72,10 +72,5 @@ """DB-SIG compliant module for communicating with MS SQL servers""" | ||
| __author__ = "Mikhail Denisenko <denisenkom@gmail.com>" | ||
| try: | ||
| __version__ = utils.package_version("python-tds") | ||
| except Exception: | ||
| __version__ = "DEV" | ||
| intversion = utils.ver_to_int("1.0.0") | ||
| intversion = utils.ver_to_int(__version__) | ||
| #: Compliant with DB SIG 2.0 | ||
@@ -358,2 +353,3 @@ apilevel = "2.0" | ||
| host, port, instance = login.servers[0] | ||
| login.servers.rotate(1) | ||
| return _connect( | ||
@@ -378,3 +374,3 @@ login=login, | ||
| raise ex | ||
| elif isinstance(ex, BrokenPipeError): | ||
| elif isinstance(ex, BrokenPipeError) or isinstance(ex, socket.timeout): | ||
| # Allow to retry when BrokenPipeError is received | ||
@@ -427,14 +423,11 @@ pass | ||
| """ | ||
| login.server_name = host | ||
| login.instance_name = instance | ||
| resolved_port = instance_browser_client.resolve_instance_port( | ||
| server=host, port=port, instance=instance, timeout=timeout | ||
| ) | ||
| if not sock: | ||
| logger.info("Opening socket to %s:%d", host, resolved_port) | ||
| sock = socket.create_connection((host, resolved_port), timeout) | ||
| try: | ||
| login.server_name = host | ||
| login.instance_name = instance | ||
| resolved_port = instance_browser_client.resolve_instance_port( | ||
| server=host, port=port, instance=instance, timeout=timeout | ||
| ) | ||
| if not sock: | ||
| logger.info("Opening socket to %s:%d", host, resolved_port) | ||
| sock = socket.create_connection((host, resolved_port), timeout) | ||
| except Exception as e: | ||
| raise LoginError(f"Cannot connect to server '{host}': {e}") from e | ||
| try: | ||
| sock.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1) | ||
@@ -441,0 +434,0 @@ |
@@ -36,2 +36,3 @@ """ | ||
| from pytds.tds_session import _TdsSession | ||
| import OpenSSL | ||
@@ -959,3 +960,3 @@ | ||
| self.enc_flag = 0 | ||
| self.tls_ctx = None | ||
| self.tls_ctx: None | OpenSSL.SSL.Context = None | ||
| self.client_tz: datetime.tzinfo = pytds.tz.local | ||
@@ -962,0 +963,0 @@ self.option_flag2 = 0 |
+4
-1
@@ -161,6 +161,9 @@ from __future__ import annotations | ||
| login = tds_sock.conn._login | ||
| tls_ctx = login.tls_ctx | ||
| if not tls_ctx: | ||
| raise Exception("login.tls_ctx is not set unexpectedly") | ||
| bhost = login.server_name.encode("ascii") | ||
| conn = OpenSSL.SSL.Connection(login.tls_ctx) | ||
| conn = OpenSSL.SSL.Connection(tls_ctx) | ||
| conn.set_tlsext_host_name(bhost) | ||
@@ -167,0 +170,0 @@ # change connection to client mode |
+6
-15
@@ -7,3 +7,2 @@ """ | ||
| import logging | ||
| import sys | ||
| import time | ||
@@ -13,7 +12,2 @@ import typing | ||
| if sys.version_info < (3, 8): | ||
| import pkg_resources | ||
| else: | ||
| from importlib import metadata | ||
| logger = logging.getLogger("pytds") | ||
@@ -54,9 +48,12 @@ T = typing.TypeVar("T") | ||
| ex_handler(ex) | ||
| if time.time() >= end_time: | ||
| raise TimeoutError() from ex | ||
| remaining_attempt_time = try_time - (time.time() - try_start_time) | ||
| cur_time = time.time() | ||
| remaining_attempt_time = try_time - (cur_time - try_start_time) | ||
| logger.info("Will retry after %f seconds", remaining_attempt_time) | ||
| if remaining_attempt_time > 0: | ||
| time.sleep(remaining_attempt_time) | ||
| cur_time += remaining_attempt_time | ||
| if cur_time >= end_time: | ||
| raise TimeoutError() from ex | ||
| try_time *= backoff_factor | ||
| try_time = min(try_time, end_time - cur_time) | ||
@@ -91,7 +88,1 @@ | ||
| return (int(maj) << 24) + (int(minor) << 16) | ||
| def package_version(name: str) -> str: | ||
| if sys.version_info < (3, 8): | ||
| return pkg_resources.get_distribution(name).version | ||
| return metadata.version(name) |
| Metadata-Version: 2.1 | ||
| Name: python-tds | ||
| Version: 1.15.0 | ||
| Version: 1.16.0 | ||
| Summary: Python DBAPI driver for MSSQL using pure Python TDS (Tabular Data Stream) protocol implementation | ||
@@ -11,6 +11,7 @@ Home-page: https://github.com/denisenkom/pytds | ||
| Classifier: Programming Language :: Python | ||
| Classifier: Programming Language :: Python :: 2.7 | ||
| Classifier: Programming Language :: Python :: 3.3 | ||
| Classifier: Programming Language :: Python :: 3.4 | ||
| Classifier: Programming Language :: Python :: 3.5 | ||
| Classifier: Programming Language :: Python :: 3.8 | ||
| Classifier: Programming Language :: Python :: 3.9 | ||
| Classifier: Programming Language :: Python :: 3.10 | ||
| Classifier: Programming Language :: Python :: 3.11 | ||
| Classifier: Programming Language :: Python :: 3.12 | ||
| License-File: LICENSE.txt |
@@ -8,2 +8,3 @@ pytest>=3.3.2 | ||
| pyOpenSSL<22.1.0 | ||
| types-pyOpenSSL | ||
| pyDes | ||
@@ -17,6 +18,7 @@ ntlm-auth | ||
| cryptography < 3.3 | ||
| sqlalchemy-pytds==1.0.0 | ||
| SQLAlchemy==2.0.22 | ||
| mypy | ||
| pytest-mypy | ||
| ruff | ||
| sqlalchemy-pytds | ||
| SQLAlchemy==2.0.34 | ||
| mypy==1.7.1 | ||
| pytest-mypy==0.10.3 | ||
| ruff==0.6.3 | ||
| setuptools==75.1.0 |
+10
-6
@@ -39,11 +39,12 @@ # -*- coding: utf-8 -*- | ||
| def call_git_describe(abbrev=4): | ||
| def git_describe(abbrev=4): | ||
| try: | ||
| p = Popen(["git", "describe", "--abbrev=%d" % abbrev], stdout=PIPE, stderr=PIPE) | ||
| p = Popen(["git", "describe", "--long", "--abbrev=%d" % abbrev], stdout=PIPE, stderr=PIPE) | ||
| p.stderr.close() | ||
| line = p.stdout.readlines()[0] | ||
| return line.strip().decode("utf8") | ||
| version_str = line.strip().decode("utf8") | ||
| version, changes, commit_hash = version_str.split("-") | ||
| return version, int(changes), commit_hash | ||
| except: | ||
| return None | ||
| return None, None, None | ||
@@ -79,3 +80,3 @@ | ||
| version = call_git_describe(abbrev) | ||
| version, changes, commit_hash = git_describe(abbrev) | ||
@@ -93,2 +94,5 @@ # If that doesn't work, fall back on the value that's in | ||
| if changes is not None and changes != 0: | ||
| version += f".dev{changes}" | ||
| # If the current version is different from what's in the | ||
@@ -95,0 +99,0 @@ # RELEASE-VERSION file, update the file to be current. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
354477
0.08%9141
-0.03%