Skip to main content

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 | RSS feed

This version

0.1

Download files

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

Source Distribution

django-magic-db-router-0.1.tar.gz (4.2 kB view details)

Uploaded Source

File details

Details for the file django-magic-db-router-0.1.tar.gz.

File metadata

File hashes

Hashes for django-magic-db-router-0.1.tar.gz
Algorithm Hash digest
SHA256 fe2ef5e8f0c6b9b383cacfb523851d7d2d59fe0d4455d800c4bca3ad3926b348
MD5 cdc7adb6da87f52c7c0b7a91f1fce2f9
BLAKE2b-256 9422926bdef4253bbcaed0bad06a94065a6850084a46d0b2adfd5d24675cf268

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