I just created a python module to solve this problem for myself. It's
let's you write SQL that returns Django objects. For your problem,
you could do something like this:
for ticket in DjSelect("""
from {Ticket:ticket} left join {User:ticket.resolved_by}
on {ticket.resolved_by}.id =
Ilya Semenov wrote:
> What different approach could I choose? I'm writing real-life model -
> a Ticket can either have a User (who resolved it), or not (if the
> ticket has not been yet resolved). Listing all resolved Tickets with
> corresponding Users is a simple real-life task, too.
Indeed... H
David Cramer wrote:
> but I strongly encourage you to find a
> differently solution, as LEFT JOINs can be VERY costly on system
> resources.
I realize that under some circumstances, LEFT JOINs can be costly.
However, I don't hink my case is such. Let me recall the (I believe
very simple) model:
The problem with this is, when the foreignkey can be null the only way
to reference it properly is with a LEFT JOIN. Now, I'm not sure why it
isnt implemented in ORM, but I strongly encourage you to find a
differently solution, as LEFT JOINs can be VERY costly on system
resources.
On the same not
Hello everyone,
I've run into the problem which I believe is a common use-case and is
already solved, but I can't seem to find the answer neither in
documentation, nor in django-users or django-developers.
Here it goes: how do I optimize a list query if I have null=True
foreign key in my entity?
5 matches
Mail list logo