Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Django database backend for Microsoft SQL Server that works on non-Windows systems.

Project Description


django-pymssql is a Django database backend for Microsoft SQL Server that works on non-Windows systems.

It’s a small wrapper around django-mssql that uses pymssql instead of ADO to connect to SQL Server.

It should support the same versions of Python, Django and SQL Server as django-mssql.

The original use case was to connect to SQL Server from a Django project written in Python 3 and running on Linux.


django-pymssql 1.7 almost passes Django’s test suite with:

  • Python 2.7 or 3.4
  • Django 1.7.x + django-mssql 1.6.1 + pymssql 2.1.1
  • Microsoft® SQL Server® 2012 Express


django-pymssql provides a Django database engine called sqlserver_pymssql:

    'default': {
        'ENGINE': 'sqlserver_pymssql',
        'HOST': '...',
        'NAME': '...',
        'USER': '...',
        'PASSWORD': '...','
        'OPTIONS': {
            # ...

Any parameter accepted by pymssql.connect can be passed in OPTIONS.


django-sqlserver is a fork of django-mssql that supports python-tds and pymssql in addition to ADO on Windows. Unfortunately it has diverged and it lags behind django-mssql when it comes to supporting newer Django versions.

django-pyodbc relies on pyodbc to connect to SQL Server. It requires a complex stack that doesn’t bring actual benefits. Besides it doesn’t appear to be very mature nor actively maintained.


Clone Django, pymssql, django-mssql and django-pymssql and pip install -e . each of them in a virtualenv.

Create a Django tests settings file with the database engine set to 'sqlserver_pymssql' and credentials for a testing SQL Server instance.

Go the the tests subdirectory in a clone of Django and execute ./ --settings=test_pymssql.


django-pymssql is released under the MIT license, like django-mssql. See the LICENSE file for details. Note that pymssql is released under the LGPL.

Some database version checking code was borrowed from django-sqlserver which is also released under the MIT license..

Release History

Release History

This version
History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_pymssql-1.7.1-py2.py3-none-any.whl (7.3 kB) Copy SHA256 Checksum SHA256 3.4 Wheel Jan 24, 2016
django-pymssql-1.7.1.tar.gz (4.7 kB) Copy SHA256 Checksum SHA256 Source Jan 24, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting