[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-06 Thread Michael Bayer
the issue is resolved in r5088. a special exception is made for the specific combination of "q.order_by().get()". ORDER BY is still dropped from the resulting SQL. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Grou

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-06 Thread Michael Bayer
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

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-05 Thread Michael Bayer
the order_by set on the mapper() is stripped out when using get() with 0.5: import sqlalchemy as sa import sqlalchemy.orm as orm from sqlalchemy.ext.declarative import declarative_base import StringIO import logging buf = StringIO.StringIO() logging.basicConfig(stream=buf, format = '%(message

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread az
> > However, I'd much rather discuss things from a different > > standpoint. Let me rephrase the question - what is /wrong/ (not / > > nonsensical/) about combining order_by with get(X)? The only > > difference in the SQL generated is, in fact, the ORDER BY which > > shouldn't matter. > > get() ac

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Jon
On Sep 4, 7:01 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > > In this case it means a doubling of the number of queries I already > > have, and those queries are indexed by name. Since the queries > > (sometimes fairly complex) would be almost exactly the same it would > > actually make things m

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Michael Bayer
On Sep 4, 2008, at 7:19 PM, Jon wrote: > >> In your specific case, I don't see what's so hard about creating a >> Query which has *only* those aspects which make sense both to a get() >> as well as a join()/order_by() combination (in this case the >> eagerload >> options), and passing that to

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Jon
On Sep 4, 5:54 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > as usual, since this one might turn out to be pretty controversial, I   > welcome the list to comment on this one.   The order_by().get() idea   > does fall in the category of "nonsensical" as opposed to "ambiguous" ,   > perhaps thats

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Jon
On Sep 4, 5:43 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Sep 4, 2008, at 5:55 PM, Jon wrote: > > > > > > > I'll note that I find building a single query for potentially several > > uses quite handy, whether I'm doing a get() or an additional filter/ > > filter_by. By prebuilding as much

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Michael Bayer
as usual, since this one might turn out to be pretty controversial, I welcome the list to comment on this one. The order_by().get() idea does fall in the category of "nonsensical" as opposed to "ambiguous" , perhaps thats the distinction we'd want to go on. --~--~-~--~~--

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Michael Bayer
On Sep 4, 2008, at 6:38 PM, Jon wrote: > I'd still like to request that order by be allowed - there is a big > difference between "makes no sense" and "is an error". At the moment I'm pretty convinced that allowing "makes no sense" to pass through silently is poor behavior. --~--~--

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Michael Bayer
On Sep 4, 2008, at 5:55 PM, Jon wrote: > > I'll note that I find building a single query for potentially several > uses quite handy, whether I'm doing a get() or an additional filter/ > filter_by. By prebuilding as much of the query as possible I reduce > the overall complexity of my application

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Jon
On Sep 4, 5:31 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Sep 4, 2008, at 5:33 PM, Jon wrote: > > > > > 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

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Michael Bayer
On Sep 4, 2008, at 5:33 PM, Jon wrote: > > 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

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Jon
On Sep 4, 4:33 pm, Jon <[EMAIL PROTECTED]> wrote: > 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_criteri

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Jon
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.

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Michael Bayer
On Sep 4, 2008, at 4:32 PM, Michael Bayer 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 tracke

[sqlalchemy] Re: bug? order_by + get(some_id) results in InvalidRequestError

2008-09-04 Thread Michael Bayer
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 exampl