[sqlalchemy] Re: Selecting what properties of an object will be loaded

2008-10-16 Thread Alex K

Cool, thanx

On 16 окт, 19:15, Ants Aasma <[EMAIL PROTECTED]> wrote:
> With
> session.query(User).options(undefer(User.column_a),
> defer(User.column_b), noload(User.column_c))
> column_a will be loaded with the query, column_b will be loaded on
> access and column_c will be None regardless of the value in the
> database.
>
> Ants
>
> On Oct 16, 12:56 pm, Alex K <[EMAIL PROTECTED]> wrote:
>
> > Hi All,
>
> > I wonder if there is a way to set what columns of the object will be
> > used during this particular query, to reduce the query in case if I
> > need the object, but I don't need all object properties.
>
> > is something like this: session.query(User).load('column_a') possible?
>
> > session.query([...]) - won't apply, since i need mapped object.
>
> > Thanks,
> > Alex
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Selecting what properties of an object will be loaded

2008-10-16 Thread Ants Aasma

With
session.query(User).options(undefer(User.column_a),
defer(User.column_b), noload(User.column_c))
column_a will be loaded with the query, column_b will be loaded on
access and column_c will be None regardless of the value in the
database.

Ants

On Oct 16, 12:56 pm, Alex K <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I wonder if there is a way to set what columns of the object will be
> used during this particular query, to reduce the query in case if I
> need the object, but I don't need all object properties.
>
> is something like this: session.query(User).load('column_a') possible?
>
> session.query([...]) - won't apply, since i need mapped object.
>
> Thanks,
> Alex
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Selecting what properties of an object will be loaded

2008-10-16 Thread Alex K

That's fine, but I'd like to do the same for columns

On 16 окт, 13:50, [EMAIL PROTECTED] wrote:
> for relations, u can put deferred(name) and noload(name) in
> quety.options( ...).
> no idea for plain columns
>
> On Thursday 16 October 2008 12:56:19 Alex K wrote:
>
> > Hi All,
>
> > I wonder if there is a way to set what columns of the object will
> > be used during this particular query, to reduce the query in case
> > if I need the object, but I don't need all object properties.
>
> > is something like this: session.query(User).load('column_a')
> > possible?
>
> > session.query([...]) - won't apply, since i need mapped object.
>
> > Thanks,
> > Alex
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Selecting what properties of an object will be loaded

2008-10-16 Thread az

for relations, u can put deferred(name) and noload(name) in 
quety.options( ...). 
no idea for plain columns

On Thursday 16 October 2008 12:56:19 Alex K wrote:
> Hi All,
>
> I wonder if there is a way to set what columns of the object will
> be used during this particular query, to reduce the query in case
> if I need the object, but I don't need all object properties.
>
> is something like this: session.query(User).load('column_a')
> possible?
>
> session.query([...]) - won't apply, since i need mapped object.
>
> Thanks,
> Alex
> 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~--~~~~--~~--~--~---