mssql-python - v1.19.0
View mssql-python 1.19.0 on PyPI
View mssql-python on Conda (Microsoft channel)
Enhancements
- Connection Retry Policy (#751)
What changed: Add optional RetryPolicy and retry_policy= configuration for connect() and Connection() initialization, with configurable transient SQLSTATEs, attempt limits, and backoff.
Who benefits: Applications that need bounded retries for transient connection failures.
Impact: Connection establishment can retry automatically when explicitly configured. Existing behavior is unchanged without a policy; statement retries are not included.
PR #751 | GitHub Issue #682 - Thanks @Om-singhaI for the contribution!
- Table-Valued Parameters (#789)
What changed: Add TableValuedParameter(type_name, columns, rows, *, schema=None) and synchronous execution through the default ODBC provider, streaming rows within one SQL execution.
Who benefits: Applications passing structured rows to SQL Server table-valued parameters.
Impact: Explicit table definitions support synchronous iterators, empty inputs, and nullable cells. Async integration, TVP executemany(), TVP setinputsizes() overrides, and the alternate mssql-odbc provider are not supported by this change.
PR #789
What changed: Add optional sqlstate and native_error attributes to DB-API exceptions, retaining paired diagnostics from synchronous ODBC errors.
Who benefits: Applications classifying database failures without parsing English error messages.
Impact: Callers can inspect structured diagnostics while retaining existing exception classes, messages, arguments, and serialization compatibility. Unavailable diagnostics, including async Rust/TDS metadata, remain None; retry rules are unchanged.
What changed: Add operation-scoped native cancellation foundations and public synchronous Cursor.cancel() with completion fences and checked recovery.
Who benefits: Applications requesting cancellation of supported synchronous execute, fetch, iteration, and next-result operations.
Impact: Cancellation requests target the captured active operation rather than a replacement operation. Cancellation is best effort, has no response deadline, and does not implicitly roll back transactions; wait for operation completion before reuse. Arrow, bulk-copy, and async cancellation are outside this public API's supported scope.
- POSIX Native Binary Hardening (#810)
What changed: Enable native-extension stack protection and supported fortification on POSIX, plus full RELRO, immediate binding, and non-executable stack declarations on Linux.
Who benefits: Users deploying the native extension on Linux and macOS.
Impact: Shipped native builds gain additional compiler and linker defenses. Windows behavior is unchanged.
PR #810
Bug Fixes
- Lossless Batch Parameter Inference (#907)
What changed: Correct executemany inference across Unicode, Decimal, and mixed-type batches, preserving embedded and trailing NULs during binding and retrieval.
Who benefits: Applications inserting or updating batches whose values differ in text encoding, precision, scale, or compatible type.
Impact: Batch inference preserves values and explicit input-size overrides instead of losing non-ASCII text or truncating data. Incompatible mixed types use individual execution to preserve values.
- Numeric Binding for Money-Range Decimals (#752)
What changed: Bind auto-detected executemany Decimal columns as SQL_NUMERIC with batch-wide precision and scale, replacing the money-range VARCHAR shortcut.
Who benefits: Applications comparing or binding money-range Decimal values against numeric columns through executemany.
Impact: Avoid numeric overflows caused by the shortcut while retaining the existing explicit DECIMAL/NUMERIC input-size string path.
PR #752 | GitHub Issue #745 - Thanks @vyrnsynx for the contribution!
- Korean VARCHAR Encoding (#910)
What changed: Require CP949 conversion modules in manylinux package builds and verify conversion fidelity.
Who benefits: Applications using Korean VARCHAR data with the manylinux wheels.
Impact: Restore conversion support that was missing when the wheel environment lacked the required glibc conversion modules.
PR #910