#32406: Allow QuerySet.update() to return fields on supported backends.
-------------------------------------+-------------------------------------
     Reporter:  Tom Carrick          |                    Owner:  Aivars
                                     |  Kalvāns
         Type:  New feature          |                   Status:  assigned
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):

 For the record I tried the above and
 [https://github.com/django/django/pull/19285 proposed a patch] for #27222
 that [https://github.com/django/django/pull/19298 can be built upon to
 support] for `update(returning)` in a backward compatible way by using the
 following signature discussed on the mailing list

 {{{#!python
 # Existing signature with keyword only updates.
 @overload
 def update(self, **updates) -> int: ...

 # New signature with positional only updates to preserve backward
 # compatibility with update(updates={"something"}) for models with
 # an "updates" field.
 @overload
 def update(self, updates: dict, /) -> int: ...

 # New signature with positional only updates and returning support which
 # also allows paves the way for other options in the future if needs be.
 @overload
 def update(
     self, updates: dict, *, returning: list[str] | tuple[str]
 ) -> list[tuple]: ...
 }}}

 It supports SQLite, PostgreSQL, and Oracle.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/32406#comment:23>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070195bec8ff9a-e9240151-f40f-4b00-a5a3-b1adabbd98b2-000000%40eu-central-1.amazonses.com.

Reply via email to