django-multidb-router 0.3
Round-robin multidb router for Django 1.2.
Latest Version: 0.5
With multidb.MasterSlaveRouter all read queries will go to a slave database; all inserts, updates, and deletes will do to the default database.
First, define SLAVE_DATABASES in your settings. It should be a list of database aliases that can be found in DATABASES:
DATABASES = {
'default': {...},
'shadow-1': {...},
'shadow-2': {...},
}
SLAVE_DATABASES = ['shadow-1', 'shadow-2']
Then put multidb.MasterSlaveRouter into DATABASE_ROUTERS:
DATABASE_ROUTERS = ('multidb.MasterSlaveRouter',)
The slave databases will be chosen in round-robin fashion.
If you want to get a connection to a slave in your app, use multidb.get_slave:
from django.db import connections import multidb connection = connections[multidb.get_slave()]
| File | Type | Py Version | Uploaded on | Size | # downloads |
|---|---|---|---|---|---|
| django-multidb-router-0.3.tar.gz (md5) | Source | 2010-02-09 | 3KB | 617 | |
- Author: Jeff Balogh
- Home Page: http://github.com/jbalogh/multidb-router
- License: BSD
-
Categories
- Development Status :: 4 - Beta
- Environment :: Web Environment
- Environment :: Web Environment :: Mozilla
- Framework :: Django
- Intended Audience :: Developers
- License :: OSI Approved :: BSD License
- Operating System :: OS Independent
- Programming Language :: Python
- Topic :: Software Development :: Libraries :: Python Modules
- Package Index Owner: jbalogh
- DOAP record: django-multidb-router-0.3.xml
