[Django] #31947: QuerySet.update_or_create() should use get_or_create() internally

23 views
Skip to first unread message

Django

unread,
Aug 26, 2020, 6:24:48 AM8/26/20
to django-...@googlegroups.com
#31947: QuerySet.update_or_create() should use get_or_create() internally
-------------------------------------+-------------------------------------
Reporter: homm | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database | Version: 3.1
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
`QuerySet.update_or_create()` internal method's logic perfectly repeats
`select_for_update().get_or_create()` methods chain logic.

--
Ticket URL: <https://code.djangoproject.com/ticket/31947>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 26, 2020, 6:25:19 AM8/26/20
to django-...@googlegroups.com
#31947: QuerySet.update_or_create() should use get_or_create() internally
-------------------------------------+-------------------------------------
Reporter: homm | Owner: homm
Type: | Status: assigned
Cleanup/optimization |
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by homm):

* owner: nobody => homm
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/31947#comment:1>

Django

unread,
Aug 26, 2020, 6:32:52 AM8/26/20
to django-...@googlegroups.com
#31947: QuerySet.update_or_create() should use get_or_create() internally
-------------------------------------+-------------------------------------
Reporter: homm | Owner: homm
Type: | Status: assigned
Cleanup/optimization |
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by homm):

Here is the patch:
https://github.com/django/django/pull/13349

--
Ticket URL: <https://code.djangoproject.com/ticket/31947#comment:2>

Django

unread,
Aug 26, 2020, 6:55:05 AM8/26/20
to django-...@googlegroups.com
#31947: QuerySet.update_or_create() should use get_or_create() internally
-------------------------------------+-------------------------------------
Reporter: homm | Owner: homm
Type: | Status: assigned
Cleanup/optimization |
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* stage: Unreviewed => Accepted


Comment:

Sounds reasonable.

--
Ticket URL: <https://code.djangoproject.com/ticket/31947#comment:3>

Django

unread,
Aug 27, 2020, 5:48:38 AM8/27/20
to django-...@googlegroups.com
#31947: QuerySet.update_or_create() should use get_or_create() internally
-------------------------------------+-------------------------------------
Reporter: homm | Owner: homm
Type: | Status: assigned
Cleanup/optimization |
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/31947#comment:4>

Django

unread,
Aug 27, 2020, 6:47:54 AM8/27/20
to django-...@googlegroups.com
#31947: QuerySet.update_or_create() should use get_or_create() internally
-------------------------------------+-------------------------------------
Reporter: homm | Owner: homm
Type: | Status: closed

Cleanup/optimization |
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"20d38fd75903b58335abd8e7cc576a1f1219a4fa" 20d38fd7]:
{{{
#!CommitTicketReference repository=""
revision="20d38fd75903b58335abd8e7cc576a1f1219a4fa"
Fixed #31947 -- Made QuerySet.update_or_create() reuse get_or_create().
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31947#comment:5>

Reply all
Reply to author
Forward
0 new messages