We just shipped mssql-python 1.8.0, the official Microsoft SQL Server driver for Python. This release focuses on day-to-day ergonomics, a long-requested authentication option for Bulk Copy, and a refresh of the bundled ODBC driver.
pip install --upgrade mssql-python
Highlights
Row objects now support string-key indexing
Row already supported integer indexing and attribute access. In 1.8.0 you can also index by column name, which is the pattern most users reach for first:
cursor.execute("SELECT id, display_name FROM users WHERE id = ?", [42])
row = cursor.fetchone()
row[0] # 42 - by index
row.display_name # 'Ada' - by attribute
row["display_name"] # 'Ada' - new in 1.8.0
If you set cursor.lowercase = True, string-key lookups become case-insensitive too, matching the casing behavior of attribute access.
ActiveDirectoryMSI authentication for Bulk Copy
Bulk Copy operations now support Authentication=ActiveDirectoryMSI, so workloads running with a managed identity (Azure VMs, App Service, Functions, Container Apps, AKS) can stream bulk inserts to Azure SQL without provisioning a separate credential.
Bundled ODBC driver upgraded to 18.6.2.1
We've upgraded the bundled Microsoft ODBC Driver for SQL Server from 18.5.1.1 to 18.6.2.1. You pick up the upstream fixes and TLS/cert improvements just by upgrading the wheel. No separate ODBC install step.
Bug fixes worth calling out
- Deferred connect-attribute use-after-free. Values passed to connection attributes set before connect are now stored in member buffers, so the driver no longer reads freed memory in some attribute-set paths.
- Connection string parsed multiple times in the auth path. The auth code path was reparsing the connection string several times per connect. It now operates on the already-parsed parameter dictionary, which is both faster and easier to reason about. Sensitive parameters (UID, PWD, Trusted_Connection, Authentication) are sanitized through a single canonical path before the ODBC handoff.
- executemany type annotation regression. seq_of_parameters now uses a covariant Sequence, so passing a list of tuples (or any covariant sequence type) type-checks cleanly again.
Upgrading
For most users, pip install --upgrade mssql-python is all you need. Nothing in this release is intentionally breaking. If you have type stubs or mypy pins that depended on the previous invariant seq_of_parameters annotation, you can drop the workaround.
Thanks
Thanks to everyone who filed issues, sent repros, and reviewed PRs in this cycle. The Row indexing and connection-string parsing work came directly from user-reported scenarios.
Full changelog and PR list: microsoft/mssql-python releases.