Queryset attribute query has method join() which allows to explicitly
make JOINs. First argument passed to this method is a tuple of left
table, right table, left column and right column, and rest of
arguments define if we have LEFT OUTER or INNER join. Arguments from
the tuple are used to create an "ON" expression like
left_table.left_column=right_table.right_column.
I need to have for the "ON" expression slighlty more complex
expression, something like
"left_table.left_column=right_table.right_column AND
right_table.another_column=42". Method join() obviously can not be
used for this purpose because it tuple defining join connection
consists off 4 elements.
I suspect there is no way to create such a double join condition at
all, event without constant involved instead of column.
Tinkering with query does not promise anything here.
I could be happy with replacing a part of resulting SQL query before
it is sent to the database.
Is there a way to filter text of SQL query somewhere before it is
executed?
Best regards,
Alexander Pugachev.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment