mssql-django
Django backend for Microsoft SQL Server
Decision gist · record as of 2026-08-14
Yes. This is the official Microsoft-backed backend for SQL Server and Azure SQL, actively maintained with no known vulnerabilities, low install friction, and permissive licensing. Install it if you need Django to connect to SQL Server, Azure SQL, or Microsoft Fabric SQL Database. Be aware of documented limitations around certain field migrations, JSONField operations, and advanced query patterns—review the known limitations table if your application uses those features heavily.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Microsoft ODBC Driver 17 or 18 for SQL Server must be installed on the system; FreeTDS ODBC driver is also supported as an alternative.
- Low friction: pure Python wheel with three runtime dependencies (django, pyodbc, pytz).
- Actively maintained with a release 7 days ago and recent commits; 399 repository stars indicate established use.
License · maintenance · safety
BSD (permissive) — BSD permissive license allows commercial and private use with minimal restrictions; suitable for most production deployments.
last release 2026-08-07 (7 days) · last repo commit 2026-08-07 · 399 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 463,781 downloads/mo, #6,519 on PyPI
Alternatives
Verify before relying
pip install mssql-django
# In settings.py:
DATABASES = {
'default': {
'ENGINE': 'mssql',
'NAME': 'mydb',
'USER': 'user@myserver',
'PASSWORD': 'password',
'HOST': 'myserver.database.windows.net',
'PORT': '',
'OPTIONS': {
'driver': 'ODBC Driver 18 for SQL Server',
},
},
}- Exact scope of JSONField lookup limitations and whether they affect common query patterns
- Whether the listed known limitations (e.g., AutoField migration, floating-point arithmetic) materially impact typical Django applications
- Performance characteristics and connection pooling behavior under high concurrency
What it is and what it does
mssql-django is the official Microsoft-supported Django database backend for SQL Server and Azure SQL. It replaces Django's default backend with one that speaks SQL Server's dialect, allowing you to define Django models and run queries against SQL Server 2016–2025, Azure SQL Database, Managed Instance, and SQL Database in Microsoft Fabric. The package wraps pyodbc (a Python ODBC library) and handles the translation between Django's ORM and SQL Server's T-SQL, including transaction management, connection pooling via pyodbc, and timezone handling via pytz.
Installation is straightforward—pip pulls in django, pyodbc, and pytz automatically—and configuration happens in Django's settings.py by setting ENGINE to 'mssql' and providing connection details (HOST, USER, PASSWORD, etc.). The backend supports Django 3.2, 4.0, 4.1, 4.2, 5.0, 5.1, 5.2, 6.0, 6.1 and Python 3.8–3.14, though Django 6.0 and 6.1 require Python 3.12+. It includes known limitations around certain field migrations, JSONField operations, and some advanced query patterns, documented in the project's wiki.
Use it for
- Migrate an existing Django application from SQLite or PostgreSQL to SQL Server or Azure SQL without rewriting models or queries.
- Build a new Django web application targeting Azure SQL Database or SQL Database in Microsoft Fabric as the primary data store.
- Connect Django to an on-premises SQL Server 2019 or 2022 instance in an enterprise environment.
- Use Azure AD authentication with Django by configuring TOKEN-based or extra_params-based connection options.
- Run Django tests against a SQL Server test database with custom collation or creation-order dependencies.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is the official Microsoft-backed backend for SQL Server and Azure SQL, actively maintained with no known vulnerabilities, low install friction, and permissive licensing. Install it if you need Django to connect to SQL Server, Azure SQL, or Microsoft Fabric SQL Database. Be aware of documented limitations around certain field migrations, JSONField operations, and advanced query patterns—review the known limitations table if your application uses those features heavily.
Install
mssql-django on PyPI
Before you install
Low friction: pure Python wheel with three runtime dependencies (django, pyodbc, pytz). Actively maintained with a release 7 days ago and recent commits; 399 repository stars indicate established use.
Microsoft ODBC Driver 17 or 18 for SQL Server must be installed on the system; FreeTDS ODBC driver is also supported as an alternative.
License in practice
BSD permissive license allows commercial and private use with minimal restrictions; suitable for most production deployments.
Quickstart
pip install mssql-django
# In settings.py:
DATABASES = {
'default': {
'ENGINE': 'mssql',
'NAME': 'mydb',
'USER': 'user@myserver',
'PASSWORD': 'password',
'HOST': 'myserver.database.windows.net',
'PORT': '',
'OPTIONS': {
'driver': 'ODBC Driver 18 for SQL Server',
},
},
}
Verify before relying
- Exact scope of JSONField lookup limitations and whether they affect common query patterns
- Whether the listed known limitations (e.g., AutoField migration, floating-point arithmetic) materially impact typical Django applications
- Performance characteristics and connection pooling behavior under high concurrency
Package facts
| License | BSD permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesdjangopyodbcpytz |
| Maintenance | Actively maintained 7 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 463,781 / month, #6,519 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Framework :: DjangoFramework :: Django :: 3.2Framework :: Django :: 4.0Framework :: Django :: 4.1Framework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Framework :: Django :: 5.2Framework :: Django :: 6.0Framework :: Django :: 6.1License :: OSI Approved :: BSD LicenseOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: mssql_django-1.8.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “django sql server backend”
- mssql-djangoDjango database backend that connects Django applications to…
- python-tdsPure Python DBAPI driver for MSSQL that implements the TDS protocol…
- django-snowflakeProvides a Django database backend that connects Django ORM to…
Give your agent the search over MCP, or paste the wish link into any chat.
More Front-Ends packages
SQLAlchemy is a Python SQL toolkit and Object Relational Mapper (ORM) that provides both a high-level ORM layer for declarative object persistence and a Core SQL construction system for direct database abstraction and query building.
psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.
Alembic generates and manages database schema migrations for SQLAlchemy applications, handling version control of database structure changes with support for upgrades, downgrades, and auto-generation from model changes.
Install it if you use SQLAlchemy and need to version-control schema changes; skip it only if you manage migrations manually or use a different ORM entirely.
A Python client library for connecting to and querying Weaviate, a vector database that enables semantic search and AI-powered data retrieval.
A Python client library that connects to Databricks clusters and SQL warehouses using a Thrift-based protocol, conforming to the Python DB API 2.0 specification and supporting Arrow-based data exchange.
Install it if you need to query Databricks clusters or SQL warehouses from Python.
Psycopg 3 is a PostgreSQL database adapter for Python that enables applications to connect to, query, and manage PostgreSQL databases using Python code.
Install it if you need to connect Python to PostgreSQL.
See also mssql-python · mssql · mssql-python-odbc · pymssql · django-snowflake · pyodbc · python-tds · pypyodbc · bcpandas · dbt-sqlserver