Skip to main content

xdjango-postgres-extra

PyPI version Python versions Django 6 License: MIT

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 CONFLICT handling with DO UPDATE and DO 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.

Metadata

Release files for xdjango-postgres-extra 2.2.0

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

Source distribution (sdist)

Source distribution for xdjango-postgres-extra 2.2.0
File Size Uploaded Provenance Actions
xdjango_postgres_extra-2.2.0.tar.gz 106.2 kB Without provenance Details for xdjango_postgres_extra-2.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xdjango-postgres-extra 2.2.0
File Interpreter ABI Platform Actions
xdjango_postgres_extra-2.2.0-py3-none-any.whl Python 3 none any Details for xdjango_postgres_extra-2.2.0-py3-none-any.whl

Total release size: 207.2 kB

Release files / xdjango_postgres_extra-2.2.0.tar.gz

Download URL xdjango_postgres_extra-2.2.0.tar.gz
Size 106.2 kB
Tags Source
SHA-256 checksum
How to use checksums
acfc499f881c3bf9c87b49fe8539aabd71cf1aeab053bccc0127c3c6d3f9b45a
BLAKE2b-256 checksum
How to use checksums
e3572152cc6863dea13b518454f5b8f39ea8b0bb5c57df437e784996c097d792
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / xdjango_postgres_extra-2.2.0-py3-none-any.whl

Download URL xdjango_postgres_extra-2.2.0-py3-none-any.whl
Size 100.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
715c9b6178f11475eb0c60ce68a1db5c62394cea4717e0128856e711c4203a28
BLAKE2b-256 checksum
How to use checksums
1f3c39f98099f5e74e9470137026d414e070137dd45e00a5cb051aa10a5bd280
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for xdjango-postgres-extra 2.2.0

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.

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