On Sep 6, 2008, at 7:35 AM, Kyle Schaffrick wrote:
> I imagine using the "ambiguous" discriminator instead of "nonsensical"
> might partition the various other query criteria a bit differently as
> well, but in my present state of mental capacity, order_by() is the
> only
> one I can think of that this applies to :)
To make this very specific, here is the method we're talking about:
def __no_criterion_condition(self, meth):
if self._criterion or self._statement or self._from_obj or \
self._limit is not None or self._offset is not None
or \
self._group_by or self._order_by:
raise sa_exc.InvalidRequestError("Query.%s() being called
on a Query with existing criterion. " % meth)
self._statement = self._criterion = self._from_obj = None
self._order_by = self._group_by = self._distinct = False
self.__joined_tables = {}
This method is used by a few methods which do need to raise if
order_by() is set, since order_by() would not normally be a noop in
those cases but existing order_by's are incompatible with the
generative method being called - these are with_polymorphic() and
select_from(), both of which affect aliasing behavior which isnt
retroactively applied to existing state (which isn't for any huge
reason except to limit implementation/test coverage burden).
It is also used by "from_statement()", which is another one of those
methods where we could just blow away all the above without
raising. (no plans for that at the moment).
So for the very specific case of get(), we'd provide a new version of
the above method which does everything the same, except doesn't raise
for "order_by". it seems like "distinct" is also silently dropped.
The fact that its so slightly different is what makes it seem
suspicious on the implementation side. But I'll certainly go with
what appears to be consensus.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---