My favorites | Sign in
Project Logo
                
Code license: New BSD License
Labels: django, mssql, pyodbc, python, odbc

Description

A Django external database backend for MS SQL Server that uses ODBC by employing the pyodbc library, supports SQL Server 2000 and 2005.

Pyodbc seems to be a mature, viable way to access SQL Server from Python in multiple platforms and is actively maintained. It's also used by SQLAlchemy for SQL Server connections.

Important

If you are following Django trunk development and have revision 10026 or newer, the minimal development revision of django-pyodbc trunk you need to use is r157.

Also, the DATABASE_ODBC_DRIVER, DATABASE_ODBC_DSN and DATABASE_ODBC_EXTRA_PARAMS settings were migrated to the DATABASE_OPTIONS dictionary setting in this revision.

This is a backward-incompatible change for setups that were using at least one of these three settings. The equivalent DATABASE_OPTIONS keys are 'driver, 'dsn' and 'extra_params' respectively.

SVN trunk development follows closely Django development, so it needs a recent checkout of Django SVN trunk. On Jan 24, 2009 (r138) a django-1.0.x SVN branch was created, its main purpose is to remain compatible with the Django 1.0.x maintenance branch.

See our News page.

Features

Installation

Configuration

See Settings. Examples:

On Windows, accessing SQL Server 2005:

DATABASE_ENGINE = 'sql_server.pyodbc'
DATABASE_NAME = 'db_name'
DATABASE_USER = 'webapp'
DATABASE_PASSWORD = 'sikrit'
DATABASE_HOST = r'test_server\SQLEXPRESS'
DATABASE_OPTIONS= {
    'driver': 'SQL Native Client',
    'MARS_Connection': True,
}

Using FreeTDS plus unixODBC on Linux/Unix, accessing SQL Server 2000:

DATABASE_ENGINE = 'sql_server.pyodbc'
DATABASE_NAME = 'the_database'
DATABASE_USER = 'django_access'
DATABASE_PASSWORD = 'guessme'
DATABASE_OPTIONS = {
    'driver': 'FreeTDS',
    'dsn': 'MyDSN', # ODBC DSN name defined in your odbc.ini
}

Testing environments

Tested on:

Open issues

Currently, the following parts of the Django test suite don't pass:

Thanks









Hosted by Google Code