mssql‑python is now Generally Available (GA) as Microsoft’s official Python driver for SQL Server, Azure SQL, and SQL databases in Fabric. This release delivers a production‑ready, high‑performance, and developer‑friendly experience.
Most Python SQL Server drivers, including pyodbc, route calls through the Driver Manager, which has slightly different implementations across Windows, macOS, and Linux. This results in inconsistent behavior and capabilities across platforms. Additionally, the Driver Manager must be installed separately, creating friction for both new developers and when deploying applications to servers.
At the heart of the mssql-python driver is DDBC (Direct Database Connectivity) — a lightweight, high-performance C++ layer that replaces the platform’s Driver Manager.
Key Advantages:
- Provides a consistent, cross-platform backend that handles connections, statements, and memory directly.
- Interfaces directly with the native SQL Server drivers.
- Integrates with the same TDS core library that powers the ODBC driver.
By simplifying the architecture, DDBC delivers:
- Consistency across platforms
- Lower function call overhead
- Zero external dependencies on Windows (
pip install mssql-pythonis all you need) - Full control over connections, memory, and statement handling
To expose the DDBC engine to Python, mssql-python uses PyBind11 – a modern C++ binding library.
PyBind11 provides:
- Native-speed execution with automatic type conversions
- Memory-safe bindings
- Clean and Pythonic API, while performance-critical logic remains in robust, maintainable C++.
- ODBC Driver Now Ships Exclusively via
mssql-python-odbc- Thelibs/fallback introduced in v1.12.0 has been removed.mssql-pythonnow hard-depends onmssql-python-odbc==18.6.2.1;pip install mssql-pythonstill Just Works and transparently pulls the driver package. Wheels are smaller and driver binaries are managed independently (#693). - Apache Arrow Bulk Copy - New
Cursor.bulkcopy_arrow(table_name, source)method for high-performance bulk loading frompyarrow.Table,RecordBatch, or any object exposing the Arrow C Data Interface, avoiding Python row materialization. The classicbulkcopy()now raisesTypeErrorfor Arrow inputs and steers users to the new method (#665). token_provider=Parameter for Azure Identity -connect()now accepts atoken_providerobject with a.get_token(scope)method, enablingDefaultAzureCredential,AzureCliCredential,ManagedIdentityCredential, and any custom credential fromazure-identity. Bulk copy re-acquires a fresh token per operation. Mutually exclusive withAuthentication=in the connection string (#603).- Identity-Aware Connection Pooling with Token-Expiry Refresh - The pool now keys on the security context (connection string + identity discriminator) so a connection authenticated as user A can never be handed to user B. Token acquisition is deferred to pool misses, and pooled connections whose token is within 5 minutes of expiry are refreshed automatically (#660).
- Silent Zero-Row
executemanyBatches on Late NULLs - Fixed numeric array parameter binding paths (TINYINT/SMALLINT/INT/FLOAT) that left indicator slots uninitialized when a NULL appeared partway through the batch, causing the batch to insert zero rows without raising (#702, issue #670). SQL_WVARCHAROutput Converter Applied to Non-String Columns - The legacySQL_WVARCHARcatch-all no longer runs againstINT/DECIMAL/DATEcolumns. Registering a singleSQL_WVARCHARconverter used to mangle every non-string column value; the fallback is now gated onstr/bytesmapped types, matchingRow._apply_output_converters(#692, issue #691).- Integer-Keyed Output Converters Now Fire -
Connection.add_output_converter(SQL_DECIMAL, ...)and any other integer ODBC SQL type code as a key now dispatch correctly. Previously the converter dictionary was keyed only by Python type, so integer-keyed registrations were silently stored but never invoked, diverging frompyodbcand from the driver's own documentation. Integer keys take precedence over Python-type keys, andSQL_DECIMALvsSQL_NUMERICare dispatched distinctly (#690, issue #684). RecordBatchReader.Close()for Arrow Result Sets -Cursor.arrow_reader()now returns a wrapped reader whose.close()stops fetching, releases the server-side cursor, resets cursor state, and leaves the parent cursor usable. Supports idempotent close and context-manager usage (#644, issue #643).AttributeErroron Partially-InitializedCursorCleanup -Cursor.__init__now setsself.closed = Falseandself.hstmt = Nonebefore any code that can raise,close()defends withgetattr(self, "closed", True), and__del__uses the correctsys.is_finalizing()guard, so half-constructed cursors no longer emit unraisable exceptions during garbage collection (#646, issue #642).
For more information, please visit the project link on Github: https://github.com/microsoft/mssql-python
If you have any feedback, questions or need support please mail us at mssql-python@microsoft.com.
As we continue to refine the driver and add new features, you can expect regular updates, optimizations, and bug fixes. We encourage you to contribute, provide feedback and report any issues you encounter, as this will help us improve the driver.