统计次数

results = qeng.query(Author.name, Author.id, func.count().label('poem_cnt')).

join(Poem, Poem.author_id==Author.id).group_by(Author.name).order_by('poem_cnt desc').limit(50)

like查询

authors = Author.query.filter(Author.name.like("%" + query + "%")).all()