Skip to content

feat(connections): Support mssql-python driver.#5647

Closed
walanguzzi wants to merge 11 commits into
SQLMesh:mainfrom
walanguzzi:feature/support-mssql-python-driver
Closed

feat(connections): Support mssql-python driver.#5647
walanguzzi wants to merge 11 commits into
SQLMesh:mainfrom
walanguzzi:feature/support-mssql-python-driver

Conversation

@walanguzzi

@walanguzzi walanguzzi commented Jan 8, 2026

Copy link
Copy Markdown

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.

Note

This was due to my initial tag-less checkout, fetching the upstream release tags allowed setuptools-scm to derive the real version string (as it does in CI).

@CLAassistant

CLAassistant commented Jan 8, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@walanguzzi walanguzzi marked this pull request as ready for review January 8, 2026 03:54
DATETIMEOFFSET is natively supported by `mssql-python`.

See "microsoft/mssql-python#213"
- Added a TODO re its removal as it should already
  be supported natively by `mssql-python`.
chore: Sync upstream `main`.
@codykonior-hsi

codykonior-hsi commented Mar 11, 2026

Copy link
Copy Markdown

I'm interested in having this driver in the product because the existing driver does not work well with my VPN. I have a set of patches I use to do it, but, didn't submit them because I couldn't do it very cleanly.

I can't comment on the PR itself.

@RG-sw

RG-sw commented May 22, 2026

Copy link
Copy Markdown

@walanguzzi thanks for the contribution! Are there any updates on this pending PR? Is there someone we can ping?

@walanguzzi

Copy link
Copy Markdown
Author

Thanks @RG-sw and @codykonior-hsi. We've been waiting for a review from one of the maintainers, however, it seems this branch is now out-of-date and needs rebasing against main (CC-GHA migration etc.).

I will do this within the next few days and then try to @ someone from the team so hopefully it gains some traction🤞

@walanguzzi walanguzzi force-pushed the feature/support-mssql-python-driver branch from 5cb4445 to 3ef6512 Compare June 14, 2026 20:14
…sql-python-driver

Integrates 63 upstream commits since 4f833af (sqlglot v30, Pydantic 2.13
compat, StarRocks engine, ClickHouse secure field, BigQuery reservations,
Databricks connection pool, CI circleci->github migration) while preserving
the mssql-python driver support. Auto-merged with zero textual conflicts; all
66 connection-config tests pass.

Co-Authored-By: Claude <noreply@anthropic.com>
@walanguzzi walanguzzi marked this pull request as draft June 14, 2026 21:40
@walanguzzi walanguzzi closed this Jun 14, 2026
@walanguzzi walanguzzi reopened this Jun 14, 2026
@walanguzzi walanguzzi marked this pull request as ready for review June 14, 2026 22:09
@walanguzzi walanguzzi force-pushed the feature/support-mssql-python-driver branch from 00fcd17 to 37f80e7 Compare June 14, 2026 22:21
@walanguzzi

walanguzzi commented Jun 14, 2026

Copy link
Copy Markdown
Author

Subsumed by #5839 for clean CI following the CircleCI migration.

@walanguzzi walanguzzi closed this Jun 14, 2026
@walanguzzi walanguzzi deleted the feature/support-mssql-python-driver branch June 14, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants