@classmethod
def largest_groups(cls, limit=10):
    member = table('member')
    package = table('package')
    j = join(member, package, (member.c.table_id == package.c.id))
    s = select([member.c.group_id, func.count(member.c.table_id)]).select_from(j).group_by(member.c.group_id).where(and_((member.c.group_id != None), (member.c.table_name == 'package'), (package.c.private == False), (package.c.state == 'active'))).order_by(func.count(member.c.table_id).desc()).limit(limit)
    res_ids = model.Session.execute(s).fetchall()
    res_groups = [(model.Session.query(model.Group).get(text_type(group_id)), val) for (group_id, val) in res_ids]
    return res_groups
@classmethod
def largest_groups(cls, limit=10):
    member = table('member')
    package = table('package')
    j = join(member, package, (member.c.table_id == package.c.id))
    s = select([member.c.group_id, func.count(member.c.table_id)]).select_from(j).group_by(member.c.group_id).where(and_((member.c.group_id != None), (member.c.table_name == 'package'), (package.c.private == False), (package.c.state == 'active'))).order_by(func.count(member.c.table_id).desc()).limit(limit)
    res_ids = model.Session.execute(s).fetchall()
    res_groups = [(model.Session.query(model.Group).get(text_type(group_id)), val) for (group_id, val) in res_ids]
    return res_groups