def get_first_aid(category): r = db.session.query( func.min(Article.id).label('min_aid') ).filter_by(category=category).one() return r.min_aid