Luke Plant wrote: > > Now I'm not sure either, looking back at the posts :-) > > Some people (e.g. Joseph) were definitely thinking in terms of doing a > UNION or UNION ALL in SQL. For 'UNION', I think the ORM constrains you > to using a single model, and therefore a single table, in which case > 'UNION' is equivalent to an 'OR', so for your use case, wouldn't this > suffice: > > reduce(operator.or_, [aModelInstance.related_set > for aModelInstance in someFunction()])
It's a bit more complicated for the empty list case, then you need to construct an empty QuerySet. > For 'UNION ALL', however, it's different, and I think some functionality > to support that would be nice. Really, I've never needed UNION ALL ... can someone provide a typical use case, so that I understand it better? A poor man's UNION ALL would be itertools.chain(*querySetList) but then it's not a QuerySet anymore. Michael --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers -~----------~----~----~----~------~----~------~--~---
