Skip to content

Instantly share code, notes, and snippets.

View JBKahn's full-sized avatar

Joseph Kahn JBKahn

View GitHub Profile
@markgajdosik
markgajdosik / update_returning.py
Last active September 11, 2016 03:04
Update-returning support for Django 1.8. Based on: https://github.com/kanu/django-update-returning
"""
Implements manager with "UPDATE .. RETURNING" clause support. Columns following
the "RETURNING" clause may be provided using `values_list()` method. If not
specified, the update statement will yield full records.
Queries executed with use of `UpdateReturningManager` or
`UpdateReturningDefaultManager` return a generator allowing easy iterating over
the returned entries.
Based on https://github.com/kanu/django-update-returning, with modifications to