#30690: get_or_create() ignores database router's db_for_read() method
-------------------------------------+-------------------------------------
     Reporter:  Maciej Olko          |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  closed
    Component:  Database layer       |                  Version:  2.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  duplicate
     Keywords:  router, database-    |             Triage Stage:
  router, get_or_create              |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

 * status:  new => closed
 * resolution:   => duplicate


Comment:

 By it's nature or dealing with both read and writes the `get_or_create`
 method '''has''' to be targeting the ''write'' database for reads.

 
[https://github.com/django/django/blob/5b57798513066bb6d5ea54225d0bd030a089c501/django/db/models/query.py#L545-L546
 There's a comment in the method definition about it]  and following the
 `git blame` trace leads to
 
[https://github.com/django/django/commit/4e9a74b81df1c7aaea2f90a3a4911920e134b275
 this commit].

 Closing as duplicate of #16865.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30690#comment:1>
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 on the web visit 
https://groups.google.com/d/msgid/django-updates/065.8ceacbef7c8b51eaf9cba45bad0014ea%40djangoproject.com.

Reply via email to