Skip to main content

Simply route complex django queries to multiple databases.

Project description

https://travis-ci.org/ambitioninc/django-dynamic-db-router.png https://coveralls.io/repos/ambitioninc/django-dynamic-db-router/badge.png?branch=develop Latest PyPI version

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)

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-dynamic-db-router-0.1.1.tar.gz (6.1 kB view details)

Uploaded Source

File details

Details for the file django-dynamic-db-router-0.1.1.tar.gz.

File metadata

File hashes

Hashes for django-dynamic-db-router-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e3da8aa3fab87edb48105617a87fa1bd7f775523f6144bbdfe5287c790efa441
MD5 8130fca45c30a9014332da6ce7d4c006
BLAKE2b-256 1bf015d2d708d9186eabec30b4f4394d4368e4a2f5ab97541ec38ee8071c90ba

See more details on using hashes here.

Supported by

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