sqlalchemy_pyodbc_mssql
SQLAlchemy's SQL Server pyodbc dialect with focused workarounds for two SQL Server/ODBC limitations:
- Repeated positional parameters in a
SELECTexpression and itsGROUP BYexpression are treated as different values by SQL Server. - SQL Server limits a statement to 2,100 parameters.
The dialect leaves ordinary statements parameterized. It uses SQLAlchemy's type-aware post-compile literal rendering for grouped expressions and expanding parameters. A conservative fallback handles statements containing more than 2,099 individual parameters.
Usage
Install the package and use mssql+pyodbc_mssql in place of
mssql+pyodbc:
pip install sqlalchemy_pyodbc_mssql
mssql+pyodbc_mssql://user:password@server/database?driver=ODBC+Driver+18+for+SQL+Server
See SQLAlchemy's Microsoft SQL Server documentation for pyodbc connection options.
Dev
Copier Template
Project structure and tooling mostly derives from Coppy. See its documentation for context and additional instructions.
This project can be updated from the upstream repo, see Updating a Project.
Project Setup
From zero to hero (passing tests that is):
-
Ensure host dependencies are installed
-
Start docker service dependencies (if applicable):
docker compose up -d -
Sync project virtualenv w/ lock file:
uv sync -
Configure prek:
prek install -
Run tests:
nox
The fast tests run without SQL Server. Live contract tests run when
MSSQL_TEST_URL is set. For ODBC Driver 18 and the supplied Compose service:
export MSSQL_TEST_URL='mssql+pyodbc_mssql://sa:SqlServer12!@127.0.0.1:1433/tempdb?driver=ODBC+Driver+18+for+SQL+Server&Encrypt=yes&TrustServerCertificate=yes'
nox -s pytest
CI uses Microsoft's official SQL Server 2022 image and probes readiness with
sqlcmd before starting the Python 3.12, 3.13, and 3.14 test sessions.
Versions
Versions are date based. A version task shows and bumps versions:
# Show current version
mise run version show
# Bump version based on date, tag, and push:
mise run version bump
# See other options
mise run version -- --help
Metadata
Release files for sqlalchemy-pyodbc-mssql 0.20261119.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sqlalchemy_pyodbc_mssql-0.20261119.1.tar.gz | 94.1 kB | With provenance | Details for sqlalchemy_pyodbc_mssql-0.20261119.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sqlalchemy_pyodbc_mssql-0.20261119.1-py3-none-any.whl | Python 3 | none | any | Details for sqlalchemy_pyodbc_mssql-0.20261119.1-py3-none-any.whl |
Total release size: 100.6 kB
Release files / sqlalchemy_pyodbc_mssql-0.20261119.1.tar.gz
| Download URL | sqlalchemy_pyodbc_mssql-0.20261119.1.tar.gz |
|---|---|
| Size | 94.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
52243abd71df063685d6cd04f975b9d800a4626978dab4dba62c356387259dfd
|
|
BLAKE2b-256 checksum How to use checksums |
b5f48b30b7e220670e74ef268ee478ee8967f0c44dfe0409fe21e5091ad079ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logRelease files / sqlalchemy_pyodbc_mssql-0.20261119.1-py3-none-any.whl
| Download URL | sqlalchemy_pyodbc_mssql-0.20261119.1-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
09de0dc60812dd0243b270949facf3748dd73ecc12e08025879eb0fadbfc2a3d
|
|
BLAKE2b-256 checksum How to use checksums |
849125de41d52f0c9590ffa8c363badb22e98ac4c55e05f06297b414b99c314b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logSecurity for sqlalchemy-pyodbc-mssql 0.20261119.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sqlalchemy_pyodbc_mssql-0.20261119.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.