Bringing all of PostgreSQL's awesomeness to Django.
Project description
xdjango-postgres-extra
xdjango-postgres-extra is a maintained fork of
django-postgres-extra.
It extends Django's PostgreSQL backend with features such as atomic upserts,
table partitioning, views, materialized views, schema management, and explicit
table locking.
The PyPI distribution is named xdjango-postgres-extra. The Python package
and existing imports remain named psqlextra.
Compatibility
- Django: 2.0 through 6.x (
Django>=2.0,<7.0) - Python: 3.6 through 3.14
- PostgreSQL: 11 or newer
- Psycopg: 2 and 3
Django 6 requires Python 3.12 or newer. The 2.1.x release line was verified with Django 6.0.6 and Python 3.14.
Installation
python -m pip install xdjango-postgres-extra
Use the psqlextra database backend in your Django settings:
DATABASES = {
"default": {
"ENGINE": "psqlextra.backend",
"NAME": "my_database",
"USER": "my_user",
"PASSWORD": "my_password",
"HOST": "localhost",
"PORT": "5432",
}
}
Add the application when using features that require app registration:
INSTALLED_APPS = [
# ...
"django.contrib.postgres",
"psqlextra",
]
Existing application code continues to use psqlextra imports:
from psqlextra.models import PostgresModel
Features
- Atomic
INSERT ... ON CONFLICThandling withDO UPDATEandDO NOTHING - Bulk inserts and upserts
- PostgreSQL range, list, hash, and default table partitions
- Time-based partition management
- Database views and materialized views integrated with migrations
- PostgreSQL schema creation, deletion, and temporary schemas
- Explicit model and table locks
TRUNCATE TABLE, including cascading truncation- HStore constraints and expressions
- PostgreSQL-specific indexes and introspection
The upstream documentation remains the primary API reference:
When following upstream installation instructions, install
xdjango-postgres-extra instead of django-postgres-extra.
Development
Create a virtual environment and install the development extras:
python -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[dev,test]"
Set a PostgreSQL test database URL:
export DATABASE_URL="postgres://psqlextra:password@localhost/psqlextra"
Run the available Poe tasks:
poe test
poe verify
License
MIT. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xdjango_postgres_extra-2.1.2.tar.gz.
File metadata
- Download URL: xdjango_postgres_extra-2.1.2.tar.gz
- Upload date:
- Size: 104.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db2eb2d8fc98c8e68d0f1cca1b48fb3024645bc5e1061363e22e531fd332d727
|
|
| MD5 |
e71d770e2afa3bdf7f2554fca64e9e4a
|
|
| BLAKE2b-256 |
5972fa2c27a59ce8fb33c7548679be66dd147bc4dd0284cf52cbfeccb1440368
|
File details
Details for the file xdjango_postgres_extra-2.1.2-py3-none-any.whl.
File metadata
- Download URL: xdjango_postgres_extra-2.1.2-py3-none-any.whl
- Upload date:
- Size: 100.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
834913040506d222487fed3506eac89fa56ad9448025ce537f424139e1cac245
|
|
| MD5 |
11ff57a1c3fc088ee2f5aab6e649eff0
|
|
| BLAKE2b-256 |
f81c41d81a0a7b1d92fd7d9d57b5e4b9b925fd9370277d6c58ca21b875f8d334
|