[sqlalchemy] Re: Outerjoin with a subset of columns

2007-08-15 Thread mc

It certainly did help .
many thanks


On Aug 15, 4:41 pm, "King Simon-NFHD78" <[EMAIL PROTECTED]>
wrote:
> > -Original Message-
> > From: sqlalchemy@googlegroups.com
> > [mailto:[EMAIL PROTECTED] On Behalf Of mc
> > Sent: 15 August 2007 14:23
> > To: sqlalchemy
> > Subject: [sqlalchemy] Outerjoin with a subset of columns
>
> > Hi,
>
> > Note the following code:
>
> > oj=outerjoin(s,f)
> > r1=select([oj]).execute().fetchall()
> > r2=select([oj.left.c.id, oj.right.c.status]).execute().fetchall()
>
> > The first select executes a LEFT OUTER JOIN and returns all columns.
> > I wanted only 2 specific columns, so I tried the 2nd select.
> > That does not execute a LEFT OUTER JOIN, though.
>
> > How do I achieve my goal?
>
> You want to use the 'from_obj' parameter for select. Something like:
>
> select([s.c.id, f.c.status], from_obj=[oj])
>
> Hope that helps,
>
> Simon


--~--~-~--~~~---~--~~
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: Outerjoin with a subset of columns

2007-08-15 Thread King Simon-NFHD78

> -Original Message-
> From: sqlalchemy@googlegroups.com 
> [mailto:[EMAIL PROTECTED] On Behalf Of mc
> Sent: 15 August 2007 14:23
> To: sqlalchemy
> Subject: [sqlalchemy] Outerjoin with a subset of columns
> 
> 
> Hi,
> 
> Note the following code:
> 
> oj=outerjoin(s,f)
> r1=select([oj]).execute().fetchall()
> r2=select([oj.left.c.id, oj.right.c.status]).execute().fetchall()
> 
> The first select executes a LEFT OUTER JOIN and returns all columns.
> I wanted only 2 specific columns, so I tried the 2nd select.
> That does not execute a LEFT OUTER JOIN, though.
> 
> How do I achieve my goal?
> 

You want to use the 'from_obj' parameter for select. Something like:

select([s.c.id, f.c.status], from_obj=[oj])

Hope that helps,

Simon

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