django-postgres-extra
Bringing all of PostgreSQL's awesomeness to Django.
Decision gist · record as of 2026-08-14
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.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a PostgreSQL 10+ database backend and Django 2.0 or newer; will not work with SQLite or other non-PostgreSQL databases.
- Low friction install with a pure-Python wheel.
- Actively maintained as of July 2026 with recent commits and a stable release history since 2017.
License · maintenance · safety
MIT License (permissive) — 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.
last release 2025-07-11 (399 days) · last repo commit 2026-07-13 · 762 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 503,783 downloads/mo, #6,301 on PyPI
Alternatives
Verify before relying
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])- 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.
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 on this page. Verify before relying on it.
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
django-postgres-extra on PyPI
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.
Requires a PostgreSQL 10+ database backend and Django 2.0 or newer; will not work with SQLite or other non-PostgreSQL databases.
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])
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 the current Python release >=3.6 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesDjangopython-dateutildataclasses |
| Maintenance | Actively maintained 399 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 503,783 / month, #6,301 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Environment :: Web EnvironmentFramework :: DjangoIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTPTopic :: Internet :: WWW/HTTP :: Dynamic Content |
Evidence: django_postgres_extra-2.0.9-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “django postgres upsert”
- django-postgres-extraExtends Django's ORM to expose PostgreSQL-specific features like…
- django-query-builderBuilds and executes complex SQL queries dynamically in Django…
- django-pg-bulk-updateExecutes bulk update and bulk create operations on PostgreSQL…
Give your agent the search over MCP, or paste the wish link into any chat.
More WWW/HTTP packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
h11 is a pure-Python HTTP/1.1 protocol implementation that handles parsing and serializing HTTP messages without any built-in I/O, letting you integrate it with any network layer you choose.
HTTPX is a fully featured HTTP client library for Python that provides both sync and async APIs, with support for HTTP/1.1 and HTTP/2, plus an integrated command-line client.
Install it if you are building new projects or modernizing existing ones that rely on HTTP.
A minimal low-level HTTP client library that sends HTTP requests with thread-safe and task-safe connection pooling, supporting HTTP/1.1, HTTP/2, proxies, and both sync and async interfaces.
aiohttp is an async HTTP client and server framework built on asyncio, supporting both WebSockets and middleware-based routing for building concurrent web applications.
Install it if you need async HTTP client or server capabilities in asyncio-based applications.
See also django-citext · django-pg-zero-downtime-migrations · django-postgres-copy · django-pg-migration-tools · django-pgviews-redux · pangres · django-pgtrigger · django-query-builder · django-pg-bulk-update · django-peeringdb