Skip to main content

Goals

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.

Status

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

Usage

django-pymssql provides a Django database engine called sqlserver_pymssql:

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

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

Alternatives

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.

Hacking

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 ./runtests.py --settings=test_pymssql.

License

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 files for django-pymssql 1.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-pymssql 1.7.1
File Size Uploaded
django-pymssql-1.7.1.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-pymssql 1.7.1
File Interpreter ABI Platform
django_pymssql-1.7.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 12.0 kB

Release files / django-pymssql-1.7.1.tar.gz

Download URL django-pymssql-1.7.1.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
cdb801c253aedc76052a6ee828dcdda70ffad815080a5b5357453aa2bb96edbf
BLAKE2b-256 checksum
How to use checksums
e13d732178407fff0f68f51da045d1528278abfdc2871d9ef0d273c4e01c32ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_pymssql-1.7.1-py2.py3-none-any.whl

Download URL django_pymssql-1.7.1-py2.py3-none-any.whl
Size 7.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
19d2cda0f79ee2e1771e5e205b525f91e2e7bd18af7a39ee1f53eea39d823e85
BLAKE2b-256 checksum
How to use checksums
a7b516bdf486865cbdda92920afef50c89641e9cd5e0b1d45ca347f1dce59998
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.7.1 This release

2 release files

1.7.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page