you are doing a join accross tables; to see what the results of that
select() looks like, try it from a shell, e.g. type in your select from:

python web2py.py -S myapp -M

Then take a look at reviews[0];

If you have ipython installed, you might like looking at it that way, as
tab-completion will give you some hints.

Let us know if this helps.

- Yarko

On Sat, Aug 22, 2009 at 5:09 AM, tititi <[email protected]> wrote:

>
> Hi, I'm testing a similiar join query but not getting success in
> extracting the dictionary
>
>    r = db.reviews
>    u = db.users
>    query = ((db.reviews.id==request.args[0]) & (db.users.id==1))
>    left= (r.on(u.id==r.user_id))
>    reviews=db(query).select
> (r.headline,r.article,u.username,left=left, orderby=r.date_added)
>    return(reviews=reviews)
>
> On the view.html
>
> {{for review in reviews:}}
>    <b>{{=review.headline}}</b>: {{=review.username}}
> {{pass}}
>
> I'm getting this error: KeyError: 'headline'
>
> Am I missing something?
>
>
> On Aug 12, 3:46 am, FERNANDO VILLARROEL <[email protected]> wrote:
> > Thank you Massimo
> >
> > --- On Tue, 8/11/09, mdipierro <[email protected]> wrote:
> >
> >
> >
> > > From: mdipierro <[email protected]>
> > > Subject: [web2py:28376] Re: Helpquery
> > > To: "web2py-users" <[email protected]>
> > > Date: Tuesday, August 11, 2009, 8:04 PM
> >
> > > Here is is broken down into pieces:
> >
> > > a=db.llamados
> > > b=db.accountcode.with_alias('b')
> > > c=db.clientes.with_alias('c')
> > >query=
> > > (b.id_clientes==clte)&(a.dialstatus=='ANSWER')&
> > > (a.inicio>=desde)&(a.inicio<=hasta)
> > > left =
> > > (b.on(a.id_accountcode==b.id),c.on(b.id_clientes==c.id))
> > > rows = db(query).select
> > >
> (a.destino,a.answeredtime,a.inicio,a.fin,a.valor,left=left,orderby=~a.inici
> o)
> >
> > > On Aug 11, 4:54 pm, FERNANDO VILLARROEL <[email protected]>
> > > wrote:
> > > > Dear all.
> >
> > > > How i can doing the followingqueryfor web2py:
> >
> > > >  select
> > > >
> > > a.destino,a.answeredtime,a.inicio,a.fin,a.valor from
> > > llamados as a
> > > >  join
> > > >         accountcode as b on a.id_accountcode=b.id
> > > >  join
> > > >         clientes as c on b.id_clientes=c.id
> >
> > > >  where id_clientes = clte and a.dialstatus='ANSWER'
> > > and (a.inicio >=
> >
> > > > desde    and a.inicio <= hasta) order by a.inicio
> > > DESC
> >
> > > > I want not use executesql.
> >
> > > > Fernando
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to