Skip to main content

Library to shard a database on the hierarchy's top level table.

Project description

DjanQuiltDB - Django Database Sharding

DjanQuiltDB is an extension to the Django web framework that provides helper functions to split a database based on top level hierarchy. It is specifically designed to support horizontal sharding not just within a single database cluster, but also across multiple database clusters, thus allowing you to scale database capacity both vertically and horizontally as your dataset grows.

This library attempts to combine the best of as many worlds as possible. Tenant-specific data is kept in tenant-specific PostgreSQL schemas, while data that is tenant-agnostic or shared can be kept in public schemas, so as to deduplicate. There are helpers to split data off from one shard to another, to migrate a shard across nodes, to synchronize changes across nodes, etc.

As the name suggests, this approach provides an interface to data, that may in reality be scattered across various schemas in various database clusters, and presents it as a coherent and easily accessible patchwork of tables, resulting in a database resembling a quilt.

Development

To setup your development environment it is important to install the development requirements first:

pip install -e .[dev]

Next, copy the example secrets file in the djanquiltdb directory and adjust the parameters:

cp secrets.json.example secrets.json

Tests

Tox can be used to run the test suite against multiple Python and Django versions:

tox

Building

Building a distribution requires the build package (pip install build). To build both the source distribution and the wheel, simply run:

python -m build

The results are then placed in the /dist folder

Documentation

Documentation can be found in the /docs directory. Build the documentation with:

make -C docs html

Attribution

This is an independently maintained fork of the patchman-django-sharding library originally created and maintained by Patchman B.V. (2017-2023) and Cloud Linux Software, Inc. (2023-2025).

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

djanquiltdb-3.1.2.tar.gz (77.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

djanquiltdb-3.1.2-py3-none-any.whl (94.8 kB view details)

Uploaded Python 3

File details

Details for the file djanquiltdb-3.1.2.tar.gz.

File metadata

  • Download URL: djanquiltdb-3.1.2.tar.gz
  • Upload date:
  • Size: 77.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for djanquiltdb-3.1.2.tar.gz
Algorithm Hash digest
SHA256 f4ef77b2bca4e48622bf0cfdca5595a6d6214f9c855af6e4853239a1d3245bac
MD5 9db2d6217aebb007a3d199b6bcaf341a
BLAKE2b-256 6d6df903a1cb245d047334a4575811a340be7e9ea82ac13a8bb6dacdab712f97

See more details on using hashes here.

File details

Details for the file djanquiltdb-3.1.2-py3-none-any.whl.

File metadata

  • Download URL: djanquiltdb-3.1.2-py3-none-any.whl
  • Upload date:
  • Size: 94.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for djanquiltdb-3.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 da0819abe5c90f2b07667993cec09669f693eac7340e6ad977e396a35c6c9449
MD5 9b0fed5c7af24f9f3740a292715cfab4
BLAKE2b-256 2663f73b4bd76e2d6b5527b9c54e0579c35e87bbb0abd8219d462f13362a28fb

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