finds.dev

SectorLabs/django-postgres-extra

Bringing all of PostgreSQL's awesomeness to Django.

View on GitHub

★ 766PythonMITupdated Oct 2026

// the take

A Django ORM extension that exposes PostgreSQL-specific features Django core doesn't support: atomic upsert via ON CONFLICT, declarative table partitioning, views/materialized views as models, schema management, and table locking. For teams running Postgres who are tired of writing raw SQL migrations for these features and want them tracked by Django's migration system instead.

The ON CONFLICT upsert support is the real draw - single-statement, concurrency-safe atomic upserts with conditional update logic, which plain Django still can't do cleanly. Table partitioning is fully wired into Django's migration framework (not just a raw-SQL escape hatch), including a command to auto-create time-based partitions. The version matrix is genuinely wide (Django 2.0 through 5.2, Python 3.7 through 3.13, psycopg 2 and 3) and CI actually tests against it, which signals real upkeep rather than a one-off side project.

It works by monkey-patching Django's migration internals (patched_autodetector, patched_migrations, patched_project_state) - that's inherently fragile and means every new Django release is a potential breaking change the maintainers have to chase. You're locked to Postgres permanently; there's no abstraction to fall back on if you ever need multi-DB support. Partition creation and materialized view refresh are both manual management commands (pgpartition, pgrefreshmv) with no built-in scheduler, so you're on the hook for cron wiring yourself. It's maintained by a single company (SectorLabs) rather than a broad community, so bus-factor risk is worth weighing even with decent test coverage.

We read the README, the directory tree and a key source file in November 2026. Nobody pays to be listed. How we judge →

search the same ground:

// at a glance

Stars
766
Forks
118
Language
Python
License
MIT
Last commit
25 Oct 2026

// nearby

If django-postgres-extra isn't quite it.

All repos →