It is kinda possible. Save both queries as objects. Left is just a query
that tells web2py which fields in the tables should be linked together.

For example,

lefton = (db.friend.dog_id == db.dog.id)
where = db(db.friend.name == "fred")
... continue and do some stuff with the "where" query object
results = where.select(db.friend.ALL, left = lefton)

--
Thadeus




On Thu, Jul 22, 2010 at 4:10 PM, mwolfe02 <[email protected]>wrote:

> It turns out the error I got it was for a different syntactical
> mistake I'd made.  The relevant error is slightly different:
>
> TypeError: 'Rows' object is not callable
>
> I assume this is because the .select() method returns a 'Rows' object?
>
> On Jul 22, 4:09 pm, Michael Wolfe <[email protected]>
> wrote:
> > I'm still learning web2py, so bear with me.  I am trying to write a
> > somewhat complex query and would like to build it as a series of
> > smaller, easier to understand queries.  web2py seems to support this
> > beautifully for INNER JOINs and WHERE clauses as explained here:
> http://www.thadeusb.com/weblog/2010/3/19/increase_productivity_by_usi...
> >
> > However, it appears that LEFT JOINs are not supported in the same way,
> > because they are only available from within the .select() method.  I
> > tried doing this and received the following error:
> >
> > TypeError: 'SQLJoin' object is not callable
> >
> > Is there any sort of workaround or am I stuck creating my left joins
> > when I call .select()?
> >
> > Thanks,
> > Mike
>

Reply via email to