Registry / database / django-mssql-backend

django-mssql-backend

JSON →
library2.8.1pypypiunverified

A Django database backend for Microsoft SQL Server. Version 2.8.1 is the latest stable release. Provides support for SQL Server connections using pyodbc. Maintenance mode but still actively used.

pip install django-mssql-backend
INSTALL
IMPORT
SIG · DJANGO-MSSQL-BACKE
D
django-mssql-backend
databasepythonv2.8.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DatabaseWrapper
from sql_server.pyodbc.base import DatabaseWrapper
from django.db.backends import BaseDatabaseWrapper

Configure Django to use the mssql backend. Ensure ODBC driver is installed.

# settings.py DATABASES = { 'default': { 'ENGINE': 'mssql', 'NAME': os.environ.get('DB_NAME', ''), 'USER': os.environ.get('DB_USER', ''), 'PASSWORD': os.environ.get('DB_PASS', ''), 'HOST': os.environ.get('DB_HOST', ''), 'PORT': os.environ.get('DB_PORT', '1433'), 'OPTIONS': { 'driver': 'ODBC Driver 17 for SQL Server', }, } }
Debug
Known issues
breakingDjango 3.2+ requires using 'mssql' engine string; older 'sql_server.pyodbc' is deprecated.
fix
Use ENGINE: 'mssql' in DATABASES setting.
affects: >=2.8.0
deprecatedPython 2 support dropped. Django 2.2 is minimum.
fix
Use Python 3.6+ and Django 2.2+.
affects: >=2.8.0
gotchaODBC driver must be installed separately; not included with pip install.
fix
Install Microsoft ODBC Driver for SQL Server from Microsoft website.
affects: all
gotchaConflicts with 'mssql-django' backend if both are installed.
fix
Uninstall one to avoid import errors.
affects: all
Upgrade
Version history
2.8.1latest on PyPI · released Apr 22, 2020
Audit
Dependencies
djangorequiredRequired; check compatibility with Django version.
pyodbcrequiredRequired for connecting to SQL Server.
mssql-djangooptionalAlternative backend; may conflict if both installed.
Agent activity
2 hits · last 30 days
node
2
Resources
django-mssql-backend — pip install django-mssql-backend · libregistry