#29262: Custom Left Outer Join in Queries
-------------------------------------+-------------------------------------
Reporter: Sassan Haradji | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: 2.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: ORM Join | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Josh Smeaton):
A few things.
1. I wasn't aware there were situations where a LEFT OUTER JOIN would have
**better** performance than an INNER JOIN, since the LEFT JOIN looks at
and includes more data. Are you able to provide the SQL for what is being
generated and for what you want? The model definitions would also help.
2. There have been lots of questions about customising joins. As far as I
know, there have been no pull requests implementing such a thing in a
reasonable manner. If you're aware of any pull requests it'd be good if
you could share where those are so we can discuss the merits of each
change.
3. You're asking for an escape hatch that isn't the escape hatch that
django is already providing. Django provides .raw() for exactly these
purposes. If, for some technical reason, .raw() isn't appropriate, please
discuss why so we can address those particular concerns.
4. Is it possible to address your situation by using .union()? You can
represent the FULL JOIN portion with 1 query, and the NULL join portion
with a 2nd query, the .union() them together.
5. There was some work done recently on annotating joins onto querysets,
but I've been unable to find that ticket or patch.
Now I am picking up from your ticket that you're frustrated. But no open
source contributor anywhere has ever responded to the equivalent of "this
situation is really bad for me so you must fix it for me" by jumping to do
exactly that. If you want people to work, for free, on something you care
about, then it's always better to approach the conversation in a more
positive and friendly tone.
We'd also be open to any contributions you or your company would be
willing to make provided it made sense for the project.
--
Ticket URL: <https://code.djangoproject.com/ticket/29262#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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.85547f004ef97642ebd81a83b602bd7a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.