Skip to content

Choose a tag to compare

@bewithgaurav bewithgaurav released this 06 Mar 12:17

mssql-django 1.7 Release Notes (March 2026)

We're thrilled to announce mssql-django 1.7 ! This release brings first-class Django 6.0 support, Python 3.14 compatibility, SQL Server 2025 readiness, and a wave of quality-of-life improvements across the board.


Highlights

  • Django 6.0 — Full support for the latest Django, including API renames, JSON path compilation changes, and DEFAULT_AUTO_FIELD alignment
  • Python 3.14 — Verified and tested on the newest Python release
  • SQL Server 2025 — Tested and supported with CI coverage on Linux
  • ODBC Driver 18 — Now the default driver, with automatic v17 fallback
  • Composite Primary Keys — Full Django 5.2+ composite PK support with ORDER BY deduplication and ColPairs expansion
  • Developer Experience — New devcontainer, Copilot instructions, and AI-assisted development prompts

Features

Django 6.0 and Python 3.14 Support (#488, #506, #507, #508, #509, #510)

  • What changed: Comprehensive Django 6.0 compatibility across the entire backend — JSON path handling via connection.ops.compile_json_path(), compatibility shims for renamed API methods (return_insert_columns()returning_columns(), fetch_returned_insert_rows()fetch_returned_rows()), CheckConstraint parameter rename (checkcondition), DEFAULT_AUTO_FIELD alignment, db_default bulk insert support, batching and ORDER BY compatibility, JSON lookup path handling, JSON ordering with KeyTransform deduplication, StringAgg order_by support (including OuterRef), and db_default insert returning fallback with trigger-safe temp table reuse. Python 3.14 is fully tested across all configurations.
  • Who benefits: Teams adopting the latest Django and Python versions, anyone wanting to stay on the cutting edge
  • Impact: Seamless upgrade path to Django 6.0 with Python 3.14 support — no application-level changes required

SQL Server 2025 Support (#489)

  • What changed: Added SQL Server 2025 to the test matrix with Linux CI coverage. Verified compatibility with stricter identifier parsing in SQL Server 2025.
  • Who benefits: Teams evaluating or deploying on SQL Server 2025
  • Impact: Confidence that the backend works with the newest SQL Server release

Composite Primary Key Support (#462, #465, #501, #504)

  • What changed: Full composite primary key support for Django 5.2+, including ORDER BY deduplication to prevent SQL Server error 169 ("A column has been specified more than once in the order by list"), ColPairs expansion in get_order_by() to prevent ORDER BY corruption with JSONArray, bulk_update validation for composite PK fields, and tuple-lookup fallback support for Django 5.2.4+.
  • Who benefits: Applications using multi-column primary keys, a key Django 5.2 feature
  • Impact: Composite primary keys work correctly with ordering, bulk operations, and JSON functions

ODBC Driver 18 as Default (#493)

  • What changed: Default ODBC driver upgraded from v17 to v18. Automatic fallback to v17 if v18 is not installed, with a warning log and security recommendations. Connection string building refactored into a dedicated method. Added 45 new unit tests covering DatabaseWrapper utility functions.
  • Who benefits: All users — v18 includes important security improvements (encryption enabled by default)
  • Impact: Better security out of the box; existing v17 installations continue to work seamlessly via auto-fallback

Devcontainer for Local Development (#500)

  • What changed: Added a full Docker Compose–based devcontainer with SQL Server 2022 and Python 3.14, both ODBC drivers (17 & 18), shell aliases (test, testall, migrate, shell, dbshell, sqlcmd), environment-variable-driven test settings, and automatic Django source cloning for the full test suite.
  • Who benefits: New contributors and developers who want a zero-setup development environment
  • Impact: Clone → open in VS Code → start coding. No manual SQL Server or ODBC driver setup needed

Copilot Instructions & AI-Assisted Development (#495)

  • What changed: Added comprehensive GitHub Copilot instructions covering repository structure, SQL Server limitations, coding patterns (as_microsoft), testing procedures, and version compatibility. Added reusable prompt files for dev environment setup, running unit tests, and running the Django test suite.
  • Who benefits: Contributors using GitHub Copilot or AI-assisted coding tools
  • Impact: AI assistants have full project context, leading to higher-quality suggestions and faster contributions

Improvements

Enhanced quote_name() Identifier Handling (#490)

  • What changed: Refactored quote_name() to treat names as single identifiers without splitting on periods. Added dedicated quote_table_name() for explicit schema.table handling. Fixes issues with annotation aliases containing periods (e.g., ordering_article.pub_date).
  • Who benefits: Applications using Django 5.2+ annotation features
  • Impact: Eliminates invalid SQL from period-containing aliases across all SQL Server versions

Meta.indexes Restoration on Field Alteration (#498)

  • What changed: Fixed _alter_field() to properly restore Meta.indexes after altering fields, preventing silent index loss during migrations.
  • Who benefits: Applications running schema migrations that alter indexed fields
  • Impact: Indexes are no longer silently dropped during field alterations

Pipeline and CI Infrastructure (#473, #474, #489)

  • What changed: Made ADO pipelines public, fixed pipeline runs on PRs, added SQL Server 2025 Linux CI, environment-variable-driven test configuration replacing sed/PowerShell scripts.
  • Who benefits: Contributors and maintainers
  • Impact: More reliable, transparent, and reproducible CI builds

Bug Fixes

JSON Lookup Path Handling (#506)

  • What changed: Fixed JSON path compilation to prevent double-escaping of special characters. Clarified the JSON path contract between compile_json_path() and compile_json_path_final_key().
  • Who benefits: Applications using JSONField lookups
  • Impact: Correct JSON queries across all Django versions

Batching and ORDER BY Compatibility (#507)

  • What changed: Fixed parameter handling for batching changes, constant ORDER BY with offset queries, and parameter type handling differences.
  • Who benefits: Applications with large querysets or paginated results
  • Impact: Reliable pagination and batch operations

db_default Bulk Insert Alignment (#508)

  • What changed: Aligned db_default handling for bulk insert operations with Django's internal changes.
  • Who benefits: Applications using db_default field option with bulk creates
  • Impact: Bulk inserts with database defaults work correctly

JSON Ordering and Exclusion Hygiene (#509)

  • What changed: Refactored JSON KeyTransform ORDER BY to pass through shared deduplication logic, preventing duplicate ORDER BY expressions. Unexcluded tests that were erroneously marked as SQL Server limitations. Added regression tests for JSON ordering by numeric values and key transforms.
  • Who benefits: Applications ordering by JSON keys
  • Impact: Correct and deduplicated ORDER BY for JSON field ordering

StringAgg and db_default Returning Fixes (#510, #511, #512)

  • What changed: Fixed StringAgg order_by support including OuterRef handling. Fixed db_default insert returning fallback to be trigger-safe with guarded temp table reuse.
  • Who benefits: Applications using StringAgg with ordering or db_default with triggers
  • Impact: StringAgg and db_default returning work reliably in edge cases

Package Distribution Fix (#503)

  • What changed: Excluded testapp from package distribution to prevent namespace collisions when installing mssql-django via pip. Fixed PYTHONPATH for the Django test suite runner.
  • Who benefits: All users installing mssql-django from PyPI
  • Impact: Clean package installation without extraneous test files

Version Compatibility

Component Supported Versions
Django 3.2, 4.0, 4.1, 4.2, 5.0, 5.1, 5.2, 6.0
Python 3.8 – 3.14
SQL Server 2016, 2017, 2019, 2022, 2025; Azure SQL DB / Managed Instance
ODBC Driver 17 or 18 for SQL Server (v18 is now the default)

Breaking Changes

  • Default ODBC Driver changed to v18. If you have ODBC Driver 18 installed, it will be used by default (with encryption enabled). The backend automatically falls back to v17 if v18 is not found. If you explicitly set 'driver': 'ODBC Driver 17 for SQL Server' in your OPTIONS, no change is needed.

Contributors

Thank you to everyone who contributed to this release!

Community Contributors:

  • @Bensebabillal — Co-authored the initial Django 6.0 and Python 3.14 support (#488), including CheckConstraint parameter rename and adapt_json_value() implementation
  • @robberwick — Fixed Meta.indexes restoration on field alteration (#498) and excluded testapp from package distribution (#503)

Special thanks to all community members who reported issues, tested pre-release builds, and helped make this comprehensive release.


Full Changelog

PRs included: #462, #465, #473, #474, #488, #489, #490, #493, #495, #498, #500, #501, #503, #504, #506, #507, #508, #509, #510, #511, #512