Django Dynamic DB Router
Working with multiple databases within django is supported, but the syntax requires peppering .using('my_database') throughout all queries that need to be routed to different databases. This is especially painful when trying to use libraries that were written without multiple database support in mind. With this library, running complex queries across different databases is as simple as:
from dynamic_db_router import in_database
with in_database('non-default-db'):
result = run_complex_query()
To set up you django project to be able to use this router, simply pip install django-dynamic-db-router and add DATABASE_ROUTERS=['dynamic_db_router.DynamicDbRouter'] to your Django settings.
Django Dynamic DB Router includes a number of additional features, such as:
Using in_database as a function decorator.
Read and write protection controls.
Load database configurations dynamically for the lifetime of the context manager.
For more information, and complete API documentation, see the docs, linked below.
Installation
To install the latest release, type:
pip install django-dynamic-db-router
To install the latest code directly from source, type:
pip install git+git://github.com/ambitioninc/django-dynamic-db-router.git
Documentation
Full documentation is available at http://django-dynamic-db-router.readthedocs.org
License
MIT License (see LICENSE)
Release files for django-dynamic-db-router 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-dynamic-db-router-0.3.0.tar.gz | 6.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_dynamic_db_router-0.3.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 14.1 kB
Release files / django-dynamic-db-router-0.3.0.tar.gz
| Download URL | django-dynamic-db-router-0.3.0.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a12c0414d7413c74a6371df6481d7eb5358d214543e9f9cb43633bcce3825d1
|
|
BLAKE2b-256 checksum How to use checksums |
c1a9a0756e5232c7998d738ded606971c3bd201264084d5029db23f58c23219c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_dynamic_db_router-0.3.0-py2.py3-none-any.whl
| Download URL | django_dynamic_db_router-0.3.0-py2.py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
34ee1a7eb107de3c79d4521418fbc92e098697ac4cf4a904fc26d75a59663c6f
|
|
BLAKE2b-256 checksum How to use checksums |
e60f9e775acf43516adcca62ec15e073b1a5e7b3152a7dc955da103c67b5fa92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |