feat(connections): Support `mssql-python` driver. by walanguzzi · Pull Request #5647 · SQLMesh/sqlmesh

Background

Issue #5645 - support the official mssql-python driver from Microsoft.

The new driver implements PEP 249 interfaces and should work as a pluggable drop-in: https://pypi.org/project/mssql-python/

Motivation

The driver bundles a lightweight and high-performance binary layer replacing the platform's Driver Manager hence eliminating the need for system-level ODBC installations.

As per the mssql-python overview, additional benefits include:

  • Consistency across platforms
  • Lower function call overhead
  • Zero external dependencies on Windows (the mssql-python is all that's needed)
  • Full control over connections, memory, and statement handling

Code Changes

  • Implemented connect_mssql_python and moved the prior pyodbc logic to connect_pyodbc.
  • Added driver configuration support for "mssql-python" to relevant *ConnectionConfig classes:
    • MSSQLConnectionConfig
    • AzureSQLConnectionConfig
    • FabricConnectionConfig
  • Updated documentation.
  • Automated refactors around import order (done by ruff and pylance).

Test Plan

All CI runs are successful.

The fast-test, slow-test and doc-test targets are also passing (locally).

However, there is one issue with the test_state_sync:test_version_schema test case being "out of sync" and prompting for a migration when run locally - I have yet to resolve this.