Hi,

I got some query like this:

        sites = db.session.query(model.Site, func.sum
(model.ProxyOnAir.listeners).label('listeners')).\
            join(model.OnAir).\
            outerjoin(model.ProxyOnAir).\
            group_by(model.Site.user_id).\
            order_by('listeners')

The only column I needed is Site, but however, I also need the sum of
listeners to sort sites. The result will be
[
(Site, listeners),
(Site, listeners),
(Site, listeners),
...
]

I know I can handle it like this:
map(lambda x: x[0], result)
But if I do that, I can't use result[:limit] which imply LIMIT syntax.
So my question is, how can I exclude some columns that I don't need? I
want the result be a list like this [Site, Site, Site, ...]

Thanks.
Victor Lin.
--~--~---------~--~----~------------~-------~--~----~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to