On Dec 10, 10:48 pm, aspineux <[EMAIL PROTECTED]> wrote:
> On Dec 10, 9:10 pm, aspineux <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi
>
> > I'm trying to use the result of a SQL query from ORM object
>
> > Here is my query ( return the last_login information of users per
> > domains )
>
> > s=sa.select([model.users_table.c.domain_name.label('domain_name'),
>
> > sa.func.max(model.users_table.c.last_imap_login).label('last_imap_login'),
>
> > sa.func.max(model.users_table.c.last_pop3_login).label('last_pop3_login'),
> >                ],
> > group_by=[model.users_table.c.domain_name]).alias('domain')
>
> > and I want to use it that way
>
> > for d in per_domain:
> >   print d.domain_name, d.last_imap.login, d.last_pop3_login
>
> > I need the glue in between!
>
> The glue is :
>
> per_domain=s.execute()
>
> but if I return per_domain to @paginate then  I get :
>
> StandardError: ("Variable is not a list or SelectResults or Query
> (<class 'sqlalchemy.engine.base.ResultProxy'>)", <function _wrapper at
> 0x989fa04>)
>
> Any idea how I can convert the ResultProxy into something @paginate
> will accept ?


s.execute().fetchall()

Thanks :-)

>
> > Can you help me ?
>
> > I already tried this way
>
> > class DomainStat(object):
> >     pass
>
> > domain=mapper(DomainStat, s)
>
> > but didn't find the exit
>
> > Thanks
>
> > Alain
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to