Blog Post

SQL Server Blog
3 MIN READ

mssql-django 1.7: Django 6.0, SQL Server 2025, and a Lot of Catching Up

DavidLevy's avatar
DavidLevy
Icon for Microsoft rankMicrosoft
Mar 18, 2026

For years, Django developers who needed SQL Server have had to navigate a patchwork of community forks and half-maintained backends. mssql-django changed that — an official, Microsoft-supported backend that lets you point your Django app at SQL Server and have things just work.

But we'll be honest: for a stretch there, we fell behind. Between the 1.5 release in April 2024 and 1.6 last August, over fifteen months passed with no new version — and during that time Django shipped both 5.1 and 5.2. Developers who wanted to stay current with Django were stuck waiting for backend support that wasn't there yet.

We've been working to close that gap. Version 1.6 landed Django 5.1 and 5.2 support last summer, and now 1.7 brings full Django 6.0 compatibility within weeks of its release. We're back on pace, and we intend to stay there.

Django 6.0 Is Fully Supported

This was the big one. Django 6.0 brought a wave of internal changes — revised query batching, new ORDER BY behavior, updated JSON lookup paths, db_default support in bulk inserts — and each of those touched code paths in the backend that needed careful attention. We've worked through all of it. If you're running Django 6.0, mssql-django 1.7 has you covered.

Python 3.14 support comes along for the ride, and the backend remains compatible all the way back to Django 3.2 and Python 3.8 for teams that aren't ready to jump forward yet.

Composite Primary Keys Land on SQL Server

Django 5.2 introduced composite primary keys — a long-requested feature in the Django ecosystem. Getting them to work cleanly on SQL Server took real effort. SQL Server doesn't support tuple comparisons (WHERE (a, b) IN (...)), so we built fallback logic that translates these lookups into equivalent T-SQL. ORDER BY handling for composite PKs required its own set of fixes to avoid the dreaded "column specified more than once" error.

The result: if you're on Django 5.2+ and want to use CompositePrimaryKey, it works.

SQL Server 2025

SQL Server 2025 is now officially supported and tested in CI. The compatibility matrix spans nearly a decade of SQL Server releases — from 2016 through 2025 — plus Azure SQL Database, Azure SQL Managed Instance, and SQL Database in Microsoft Fabric.

ODBC Driver 18 by Default

We've updated the default ODBC driver from v17 to ODBC Driver 18 for SQL Server. If you don't have Driver 18 installed, the backend falls back to Driver 17 automatically and logs a message, so you know what happened. If you've already set an explicit driver in your OPTIONS, nothing changes for you.

The Smaller Stuff That Matters

A few fixes that are easy to overlook but made real differences:

  • quote_name() now handles aliases with periods — if you've ever hit a confusing quoting error with dotted identifiers, this one's for you.
  • Meta.indexes no longer get dropped during field alterations — a regression from earlier versions that could silently lose your indexes on schema changes.
  • The testapp package stopped leaking into distributions — a packaging hygiene fix.

Better for Contributors, Too

We've invested in making the project easier to contribute to. There's now a devcontainer so you can spin up a full development environment in VS Code or GitHub Codespaces with a single click. We've added GitHub Copilot instructions and reusable prompt files - for dev environment setup, running unit tests, running the full Django test suite, and PR self-checks - so AI-assisted contributors can follow project conventions out of the box. And our CI pipelines are now public, so you can see exactly what's passing before you submit a PR.

Try It

pip install mssql-django==1.7 DATABASES = { 'default': { 'ENGINE': 'mssql', 'NAME': 'mydb', 'USER': 'user@myserver', 'PASSWORD': 'password', 'HOST': 'myserver.database.windows.net', 'OPTIONS': { 'driver': 'ODBC Driver 18 for SQL Server', }, }, }

Full documentation, guides, and FAQs are on the mssql-django Wiki. If you hit a problem, open an issue — we're paying attention.

What's Supported

ComponentVersions
Django3.2, 4.0, 4.1, 4.2, 5.0, 5.1, 5.2, 6.0
Python3.8 – 3.14
SQL Server2016, 2017, 2019, 2022, 2025
Azure SQLDatabase, Managed Instance, SQL Database in Microsoft Fabric
ODBC Driver17 or 18

mssql-django is open source under the BSD license. Contributions are welcome — see the Contributing Guide to get started.

Updated Mar 17, 2026
Version 1.0
No CommentsBe the first to comment