Re: [Django] #33999: Efficient filter with join on soft link. (was: Efficient filter with join on soft link)

8 views
Skip to first unread message

Django

unread,
Sep 9, 2022, 6:04:37 AM9/9/22
to django-...@googlegroups.com
#33999: Efficient filter with join on soft link.
-------------------------------------+-------------------------------------
Reporter: brandic | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution: wontfix
Keywords: QuerySet.extra | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => wontfix
* type: Cleanup/optimization => New feature
* component: Uncategorized => Database layer (models, ORM)


Comment:

As far as I'm aware, using `extra()` is the right thing to do in your
case. You could also try to change `ModelB.c` to a `ForeignKey` without a
database constraint, e.g.
{{{
c = models.ForeignKey(ModelC, ..., db_constraint=False)
}}}
but it's a bad idea in most of cases (see
[https://docs.djangoproject.com/en/stable/ref/models/fields/#django.db.models.ForeignKey.db_constraint
docs]).

Even if it's feasible I don't think there would be consensus to add that
complexity to Django itself. You can raise the idea on the
DevelopersMailingList to reach a wider audience and see what other think
(see also [https://docs.djangoproject.com/en/stable/internals/contributing
/bugs-and-features/#requesting-features the guidelines with regards to
requesting features]).

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

Reply all
Reply to author
Forward
0 new messages