--- id: django-pgviews-redux version: "1.2.0" license: unclear license_treatment: unclear maintenance: active --- # django-pgviews-redux — Create and manage Postgres SQL Views in Django License: unclear · Maintenance: active · Downloads: 234.5K/mo ## What it is and what it does django-pgviews-redux is a Django extension that brings PostgreSQL views into the ORM as first-class model-like objects. Instead of writing raw SQL or using database triggers outside Django, you define views by subclassing `pg.View`, specify the underlying SQL, and manage them through Django migrations just like regular models. The package handles view creation, updates, and deletion automatically during migrations, and provides a `sync_pgviews` management command for manual synchronization. It supports both regular views and materialized views (which cache results for faster queries). Materialized views can be refreshed manually or via signals, and on PostgreSQL 9.4+ can use concurrent refresh to avoid blocking reads. The package also handles view dependencies, ensuring dependent views are created in the correct order, and provides utilities to drop and recreate views when upstream table columns change—a common migration pain point. Use it for: - Create read-only aggregated or filtered views of your data that behave like queryable Django models without duplicating data. - Build materialized views to cache expensive query results and refresh them on demand or via signals when source data changes. - Manage complex SQL views alongside your Django models in migrations, keeping schema definitions in Python code. - Handle PostgreSQL-specific view dependencies and concurrent refresh patterns without writing raw migration operations. - Query views using the Django ORM (filtering, ordering, pagination) just like regular models, without raw SQL in application code. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Adds first-class PostgreSQL view support to Django's ORM, allowing you to define, manage, and query database views as Django models. Yes, if you use PostgreSQL and need to manage views within Django's ORM and migration system. The package is actively maintained, supports current Django and Python versions, and has no known vulnerabilities. The main caveat is the unclear license status—verify the actual license in the repository before adopting. Install friction is low and the feature set is well-documented. ## Install pip install django-pgviews-redux uv add django-pgviews-redux poetry add django-pgviews-redux ## Installing django-pgviews-redux Before you install: Low install friction with a single runtime dependency on django. Active maintenance with recent commits (2026-08-10) and support for modern Python versions (3.10–3.14) and Django versions (5.2, 6.0). License in practice: License status is unclear; the package has no SPDX identifier or raw license declaration in its metadata. Verify the actual license terms in the repository before adopting. Quickstart: pip install django-pgviews-redux # In settings.py, add 'django_pgviews' to INSTALLED_APPS from django_pgviews import view as pg from django.db import models class PreferredCustomer(pg.View): name = models.CharField(max_length=100) sql = "SELECT id, name FROM myapp_customer WHERE is_preferred IS TRUE" class Meta: managed = False # Then run: python manage.py migrate Requires PostgreSQL as the database backend; views are PostgreSQL-specific and cannot be used with other database engines. Verify before relying: - Whether the package is licensed under an open-source license compatible with your project (license metadata is absent). - Performance characteristics of materialized view refresh operations under concurrent load. - Compatibility with custom Django migration autodetectors beyond the documented subclassing pattern. ## Package facts - License: not declared (unclear) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 234.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags postgres views django orm, sql views django models, materialized views django, postgresql view management, django database views, postgres view migrations, django pgviews, django-extension, postgres-views, orm-integration [View on SkillFed](https://skillfed.io/packages/django-pgviews-redux) · [View on PyPI](https://pypi.org/project/django-pgviews-redux/)