It's not different at all. I've just noticed that on the one hand it
*is* possible to use query.order_by(None) to remove any previously set
ordering, but on the other hand that _no_select_modifiers() in
sqlalchemy/orm/query.py checks for False (and not None). It would be
clearer to me if either
OK, it looks like we did add this at some point, though I could not find a unit
test where I would expect. So I added one in the latest tip. Here it is:
class OrderByTest(QueryTest, AssertsCompiledSQL):
def test_cancel_order_by(self):
s = create_session()
q =
Adding these two lines to your test makes it fail:
q.delete()
eq_(s.query(User).count(), 0)
Here's the complete test to see it in context again:
class OrderByTest(QueryTest, AssertsCompiledSQL):
def test_cancel_order_by(self):
s = create_session()
q =
On Jun 17, 2010, at 3:15 PM, Andi Albrecht wrote:
Adding these two lines to your test makes it fail:
it turns out there is a test for this, and also that passing None does not
have the same effect as order_by() never being called in the first place - it
suppresses the order_by setting on the
With the latest revision removing a order_by that was previously set
by a mapping works fine now!
Thanks for having a look at this!
Andi
On Thu, Jun 17, 2010 at 9:56 PM, Michael Bayer mike...@zzzcomputing.com wrote:
On Jun 17, 2010, at 3:15 PM, Andi Albrecht wrote:
Adding these two lines to
Hi,
I'm a bit curious about how to unset an order_by in 0.6.
query.order_by(None) should do it, but in sqlalchemy/orm/query.py in
_no_select_modifiers() the notset value for the _order_by attribute is
False. In turn, the order_by() method doesn't seem to accept False.
What would be a proper way
its not really provided right now, the same way saying query.filter(None) won't
reset any existing WHERE criterion, or join(None) doesn't remove all joins.
This issue has come up before. How is order_by() different ?
On Jun 16, 2010, at 8:05 AM, Andi Albrecht wrote:
Hi,
I'm a bit