--- id: mssql-django version: "1.8.0" license: BSD license_treatment: permissive maintenance: active --- # mssql-django — Django backend for Microsoft SQL Server License: permissive · Maintenance: active · Downloads: 463.8K/mo ## 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 above — verify before relying. Django database backend that connects Django applications to Microsoft SQL Server, Azure SQL, and SQL Database in Microsoft Fabric via pyodbc and ODBC drivers. 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 pip install mssql-django uv add mssql-django poetry add mssql-django ## Installing mssql-django 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. 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', }, }, } Microsoft ODBC Driver 17 or 18 for SQL Server must be installed on the system; FreeTDS ODBC driver is also supported as an alternative. 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: unspecified - Install friction: low - Maintenance: active - Downloads: 463.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags django sql server backend, django mssql database, azure sql django, sql server orm django, django odbc connector, microsoft sql django, django database backend mssql, django-backend, sql-server, azure-sql [View on SkillFed](https://skillfed.io/packages/mssql-django) · [View on PyPI](https://pypi.org/project/mssql-django/)