On Sep 4, 3:32 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
> On Sep 4, 2008, at 4:17 PM, Jon wrote:
>
>
>
>
>
> > I'm using 0.4.6 but I thought I'd give 0.5b3 a try.
>
> > An existing (working) query failed with:
>
> > Query.__no_criterion() being called on a Query with existing
> > criterion.
>
> > I tracked that down to using order_by when building the query.
> > An example is below:
>
> > q = dbsess.query(Obj)
> > q = q.order_by(Obj.name)
> > instance = q.get(some_id)
>
> > Why does this happen and is it a bug?
>
> it doesn't make sense to call order_by() before calling get().   SQLA  
> raises an error instead of silently ignoring criterion which can't be  
> applied.

I'll note that if I use something like this in the ORM mapper
definition:

      order_by=meta.tables['some_table'].c.some_column,

get(pkey) continues to work *and* ORDER BY is used in the SQL.
While ORDER BY doesn't make sense when acquiring just one item, it
doesn't hurt either, and it's one small thing that people converting
from 0.4 would need to know. Is there any reason why compatibility
cannot be retained?


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to