Skip to main content

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

Project description

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 projet 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..

Project details


Download files

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

Source Distribution

django-pymssql-1.7.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

django_pymssql-1.7.0-py2.py3-none-any.whl (7.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-pymssql-1.7.0.tar.gz.

File metadata

File hashes

Hashes for django-pymssql-1.7.0.tar.gz
Algorithm Hash digest
SHA256 6d926bd7ea3e8e1fba6f55e52d1b1f330b891f95ee551c0f3864b12220d08f46
MD5 c6a377f12ef207b339c127224ce97978
BLAKE2b-256 af7327e65d5cdcf335acb6ebeb7d505e7dca1005bac56876986efc161fdc545e

See more details on using hashes here.

File details

Details for the file django_pymssql-1.7.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_pymssql-1.7.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 cd61aa077f3b232ddaa198408ca220e69732cc7d037986609d925f17ec0f2c42
MD5 62110c8d25334752f3b565f5abb61e7d
BLAKE2b-256 49f59d82c9ecc87eecdaa0000dc92c860b9a58f6f2a3ea132ad5a6c305b24389

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page