Django partitioning
Django partitioning is a package for Django, which implement PostgreSQL table partitioning on the fly, at the database level. It creates several triggers and functions and inserts them directly into the database. After setup partitioning, record will be inserted into the correct partition, if partition doesn't exist, it will be created for you automatically.
Requirements
- Django >=1.11 <=5.0
- PostgreSQL >= 8.0
Also, note psycopg2-binary (2.7.5-2.9.9) will be needed as PostgreSQL database adapter.
Installation
Install using pip...
$ pip install django-postgresql-partitioning
Configuration
- Add
partitioningtoINSTALLED_APPS:
INSTALLED_APPS = [
...
partitioning,
]
- Add partitioning configuration to your models:
from partitioning.decorators import partitioning
@partitioning([
{'type': 'list', 'column': 'tag'},
{'type': 'range_month', 'column': 'created'},
])
class Message(models.Model):
text = models.TextField()
tag = models.CharField(max_length=255)
created = models.DateTimeField()
- Lastly setup partitioning:
$ python manage.py setup_partitioning app_name
Available settings
type - partition type, currently supported:
- list
- range_day
- range_week
- range_month
- range_year
column - column, used to determine which partition record belongs to.
Testing
Clone the repo:
$ git clone https://github.com/starnavi-team/django-postgresql-partitioning.git
Install requirements.
$ pip install -r requirements.txt
Use tox testing tool to run the tests against all supported versions of Python and Django. Install tox globally, and then simply run:
$ tox
Metadata
Release files for django-postgresql-partitioning 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-postgresql-partitioning-0.1.1.tar.gz | 5.5 kB | Without provenance | Details for django-postgresql-partitioning-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_postgresql_partitioning-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for django_postgresql_partitioning-0.1.1-py3-none-any.whl |
Total release size: 11.3 kB
Release files / django-postgresql-partitioning-0.1.1.tar.gz
| Download URL | django-postgresql-partitioning-0.1.1.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5635a0698f1b5b414193cfc69fa92462ffe84754a3423374cafdb6cc681fcff7
|
|
BLAKE2b-256 checksum How to use checksums |
addd34463b6c9329c682f8eeb249413127942e3173caf37ed41823d934f33147
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.8
|
Release files / django_postgresql_partitioning-0.1.1-py3-none-any.whl
| Download URL | django_postgresql_partitioning-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
848ab84466505c9ff35daa65d0bbd078c05916100778c22dc92e7945ddcbb23d
|
|
BLAKE2b-256 checksum How to use checksums |
d213e6f0d535178121542eefe98d95c6bdf07e664170648fd1a3fb338d3e9f0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.8
|
Security for django-postgresql-partitioning 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.