Skip to main content

[[TOC]]

Description

Set of simple and usable database routers for django applitaions

dbrouter.DbByAppRouter

dbrouter.DbByAppRouter allows you to specify django-applications or models, that will work with this database.

dbrouter.RestrictMigrations

dbrouter.RestrictMigrations allows you to specify a database to which you can not apply migrations. For example, with read-only access.

dbrouter.parse_database_url

dbrouter.parse_database_url allows you to specify a database connection as one string

Example

from dbrouter import parse_database_url

# ...

INSTALLED_APPS = [
    ...
    'some_app',
    'other_app',
]

...
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'db.sqlite3',
    },
    # 'dbrouter.DbByAppRouter' usage example
    'external': {
        'NAME': 'some_other',
        .....
        'applications': [
            'some_app',                 #  all models on some_app
            'other_app.OnlyThisModel',  #  OnlyThisModel on other_app
        ],
    },
    # 'dbrouter.RestrictMigrations' usage example
    'some_read_only_external_database': {
        'NAME': 'some_read_only_external_database',
        .....
        'allow_migrate': False,
        # False - disable migrations
        # True - do not disable migrations
        # None - default
    },
    'some_db_added_by_url': parse_database_url(
        # DB in remoge PostgreSQL-server on some schema
        'psql://user:pass@remote.db.host/dbname?options=-c search_path=some_schema',
        applications=['some_new_app'],
        allow_migrate=False)
}

...
DATABASE_ROUTERS = [
    'dbrouter.DbByAppRouter',
    'dbrouter.RestrictMigrations',
    ...
]

Release files for django-dbrouter 0.1.4.post2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-dbrouter 0.1.4.post2
File Size Uploaded
django-dbrouter-0.1.4.post2.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-dbrouter 0.1.4.post2
File Interpreter ABI Platform
django_dbrouter-0.1.4.post2-py3-none-any.whl Python 3 none any Details

Total release size: 9.7 kB

Release files / django-dbrouter-0.1.4.post2.tar.gz

Download URL django-dbrouter-0.1.4.post2.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
214386fb6d8af5887ed85401d809ba58f50e906c34571faf383dcc77ed38568d
BLAKE2b-256 checksum
How to use checksums
af02f81e5053e945e8b514df00e73f8eb72c891b9bc37b03925346b0a6ef84ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

Release files / django_dbrouter-0.1.4.post2-py3-none-any.whl

Download URL django_dbrouter-0.1.4.post2-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f120db84b2f48a017a07546b044c05c406fad4be78ac8b4db89e6c7881ffc47
BLAKE2b-256 checksum
How to use checksums
a7d79cb19734e11b763bad2f16c753ea83c604ddd9869ca893c3bc9091e264ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.1.4.post2 This release

2 release files

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page