--- id: django-postgres-extra version: "2.0.9" license: MIT License license_treatment: permissive maintenance: active --- # django-postgres-extra — Bringing all of PostgreSQL's awesomeness to Django. License: permissive · Maintenance: active · Downloads: 503.8K/mo ## What it is and what it does django-postgres-extra is a Django extension that bridges the gap between Django's generic ORM and PostgreSQL's advanced capabilities. Instead of writing raw SQL or using multiple small packages, it provides a cohesive set of tools—native upserts (single-query, concurrency-safe), HStore field enhancements (unique and null constraints, key-level selection), PostgreSQL 11.x table partitioning (range and list), faster truncate operations, and specialized indexes (conditional unique, case-sensitive unique)—all integrated into Django's migration system so they work seamlessly without manual SQL. The package targets teams running Django on PostgreSQL who want to leverage database-specific performance and data-modeling features without abandoning the ORM. It depends on Django, python-dateutil, and dataclasses, and supports Python 3.6 through 3.11 and Django 2.0 through 5.0. The project is actively maintained, well-tested (with CircleCI integration and code coverage tracking), and documented via Read The Docs. Use it for: - Implement single-query upserts in high-concurrency scenarios where duplicate-key conflicts are expected and performance matters. - Add unique or null constraints to HStore fields and query individual keys without denormalization. - Partition large tables by range or list in PostgreSQL 11+ to improve query performance and maintenance on time-series or categorical data. - Replace slow Django delete operations with PostgreSQL TRUNCATE for bulk data cleanup. - Define conditional or case-sensitive unique indexes to enforce domain-specific uniqueness rules the standard ORM cannot express. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Extends Django's ORM to expose PostgreSQL-specific features like native upserts, HStore field constraints, table partitioning, and specialized indexes through a single integrated package. Yes. The package is actively maintained, has low install friction, carries a permissive MIT license, and solves real PostgreSQL-specific problems that would otherwise require raw SQL or multiple dependencies. It is a good fit if you are committed to PostgreSQL and want to use its advanced features within Django's ORM without sacrificing code clarity or migrations. Not suitable if you need database portability or are not using PostgreSQL. ## Install pip install django-postgres-extra uv add django-postgres-extra poetry add django-postgres-extra ## Installing django-postgres-extra Before you install: Low friction install with a pure-Python wheel. Actively maintained as of July 2026 with recent commits and a stable release history since 2017. Requires Django 2.0+, Python 3.6+, and a PostgreSQL 10+ backend. License in practice: MIT License permits commercial and private use with minimal restrictions—you may use, modify, and distribute this package freely as long as you include the license notice. Quickstart: pip install django-postgres-extra from django_postgres_extra import Manager class MyModel(models.Model): objects = Manager() # Use native upsert MyModel.objects.on_conflict(['id']).insert_or_update([obj]) Requires a PostgreSQL 10+ database backend and Django 2.0 or newer; will not work with SQLite or other non-PostgreSQL databases. Verify before relying: - Exact scope and completeness of PostgreSQL 11.x declarative table partitioning support (range vs. list vs. hash). - Whether concurrent upsert safety extends to all bulk operations or only specific scenarios. - Performance characteristics of the faster delete/truncate operations compared to standard Django deletes. ## Package facts - License: MIT License (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 503.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags django postgres upsert, postgresql features django orm, django hstore constraints, postgres table partitioning django, django postgres native operations, postgresql advanced indexes django, bulk upsert django, postgres-orm-extension, django-plugin [View on SkillFed](https://skillfed.io/packages/django-postgres-extra) · [View on PyPI](https://pypi.org/project/django-postgres-extra/)