- changed status to resolved
Query aliasing is screwing up the order_by collection ?
Issue #1027
resolved
need to confirm this:
I couldn't create a simple test case, but I have analyzed the cause of
the problem.
The order_by() method is sent a list as an argument, but the argument
'criterion' becomes a tuple
because of the "def order_by(self, *criterion)" syntax.
in the case of "if self._aliases_tail:" , 'criterion' becomes a list
again, but if _aliases_tail is None it remains a tuple.
Now the cause of the problem is that on the first call to order_by(),
self._aliases_tail exists, and on the 2nd call, following the
reset_joinpoint() call, it is None. Therefore the '_order_by member'
is initialized as a list, and later a tuple is attempted to be
concatenated and hence the failure.
The calling code from my source looks like this:
myquery = Node.query()
myquery = myquery.join('parent', aliased=True)
myquery = myquery.order_by(Node.c.name) #
_aliases_tail exists for this call
myquery = myquery.reset_joinpoint().order_by(Node.c.popularity) #
_aliases_tail is None for this call
Comments (2)
-
reporter -
reporter - removed milestone
Removing milestone: 0.4.6 (automated comment)
- Log in to comment
OK it was confirmed....e435591259e874c5c93f17582a0a2e882525c320