I may not understood your question well, based on the old rule: "[if
it is too easy || compiled at first], there might be something wrong".
anyway, are you looking for something like: 

s = select([Object.c.id],
from_obj=Object) 

? 

Em 2014-03-30 14:55, Jonathan Vanasco escreveu:


> I have a handful of queries that are fairly complex. 
> For these, I
need to support both 
> SELECT object.* ( for full records ) 
> SELECT
object.id ( for caching of collection ids + COUNT operations ) 
> My
current approach is really dirty. three functions wrap a "core"
generator, which does all the heavy work. They just pass in the kwargs.

> I don't really like this, because the 'core' starts like this: 
> if
ids_only or for_count: 
> query = dbSession.query( Object.id ) 
> else:

> query = dbSession.query( Object ) 
> I generally don't like writing
things that behave so differently. 
> Is it possible to query Object,
build all the joins/filters against that, and then just edit the query
to only select the 'id' afterwards ? 
> 
> -- 
> You received this
message because you are subscribed to the Google Groups "sqlalchemy"
group.
> To unsubscribe from this group and stop receiving emails from
it, send an email to [email protected] [1].
> To
post to this group, send email to [email protected] [2].
>
Visit this group at http://groups.google.com/group/sqlalchemy [3].
> For
more options, visit https://groups.google.com/d/optout [4].



Links:
------
[1] mailto:[email protected]
[2]
mailto:[email protected]
[3]
http://groups.google.com/group/sqlalchemy
[4]
https://groups.google.com/d/optout

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to