Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

Dynamic database router

Project description

=====
Django-magic-db-router
=====

Django-magic-db-router is an app to allow Django system can auto pick random database for read/write, generally!

The key feature is we can use dedicated database for code block, this will usefull for transaction handler!


Quick start
-----------
1. Install the app:
pip install django-magic-db-router

2. Config your settings file, for example:
DJANGO_MAGIC_DB_ROUTER_READ_DB_LIST=['REPLICA1', 'REPLICA2', 'REPLICA3',]
DJANGO_MAGIC_DB_ROUTER_WRITE_DB_LIST=['default',]
DATABASE_ROUTERS = ['django_magic_db_router.DynamicDbRouter']

3. For using dedicated database for code block, use: `in_database`
with in_database(db_name, write=True):
some_code()

========================================================================================

Project details


Release history Release notifications

This version
History Node

0.1

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
django-magic-db-router-0.1.tar.gz (4.2 kB) Copy SHA256 hash SHA256 Source None Jan 15, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page