On Wed, Sep 4, 2013 at 12:05 PM, lars van gemerden <[email protected]> wrote:
> I  think i must be reading over something, but:
>
> is there a way to delay the selection of attributes in a query; something
> like
>
>      >>> session.query(Person).filter(Person.age >
> 100).select(Person.name).first()
>
>      >>>  (u"Ancient Bob",)
>

I'm not sure quite what you mean, but the with_entities method of
Query would seem to be the closest to your example:

  
http://docs.sqlalchemy.org/en/rel_0_8/orm/query.html#sqlalchemy.orm.query.Query.with_entities

I assume you know you can also do this:

  session.query(Person.name).filter(Person.age > 100).first()

You can also defer certain columns so that they will be loaded lazily:

  
http://docs.sqlalchemy.org/en/rel_0_8/orm/mapper_config.html#deferred-column-loading

Hope that helps,

Simon

-- 
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/groups/opt_out.

Reply via email to