{"categories":[{"label":"Database","url":"https://skillfed.io/packages/category/database/4"}],"enrichment":{"capability":"Extends Django's ORM to capture and return rows modified by PostgreSQL UPDATE, DELETE, and bulk CREATE operations, letting you retrieve database-computed values without extra queries.","skillfed_tags":["django-orm","postgresql-specific"],"use_cases":["Retrieve auto-generated or trigger-computed values after bulk inserts without a follow-up query.","Update records with F() expressions and immediately see the evaluated result without reloading the instance.","Delete rows and capture their final state (e.g., for audit logging) in a single round-trip.","Bulk operations that depend on database defaults or computed columns to populate fields.","Workflows where you need to confirm what the database actually stored after a DML operation."],"what_it_does":"django-pg-returning bridges a gap in Django's ORM: it exposes PostgreSQL's RETURNING clause for UPDATE, DELETE, and bulk CREATE operations. Normally, Django's update() and delete() methods don't return the modified rows, and bulk_create() doesn't refresh fields with database-computed defaults or trigger-set values. This library adds QuerySet methods (update_returning, delete_returning, create_returning, bulk_create_returning) and model methods (save_returning) that execute the DML statement and immediately fetch back the affected rows, including any values computed by the database.\n\nThe result is a ReturningQuerySet\u2014a cached, in-memory collection similar to Django's RawQuerySet but with convenience methods like count(), first(), last(), values(), and values_list(). This is especially useful when you rely on database defaults, triggers, or F() expressions to compute field values and need to know what was actually stored without issuing a separate SELECT.","worth_installing":"Yes, if you use PostgreSQL and Django and frequently need to return modified rows from bulk operations or F() expressions. The library is stable and has no known vulnerabilities, but its dormant maintenance (last release 2024-01-04, no recent commits) means it may not support the latest Django versions\u2014verify compatibility with your Django version before adopting. Low install friction and permissive licensing make it a low-risk experiment."},"id":"django-pg-returning","links":{"html":"https://skillfed.io/packages/django-pg-returning","md":"https://skillfed.io/packages/django-pg-returning.md","pypi":"https://pypi.org/project/django-pg-returning/"},"maintenance":{"status":"dormant"},"meta":{"latest_release":"2024-01-04","license_spdx":null,"license_treatment":"permissive","name":"django-pg-returning","python_support":"unspecified","summary":"A small library implementing PostgreSQL ability to return rows in DML statements for Django"},"popularity":{"monthly_downloads":178490,"position":10192,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"2.0.2"}
