SQLAlchmey 排序、模糊查询
def fuzzy_query(name111): session = get_session() # db.session.query(User).filter(User.name.like('%{0}%'.format("a"))).all() users = session.query(User).filter(User.name.like('%{0}%'.format(name111))).all() session.close() return users def query_user_order_by_age1(): session = get_session() users = session.query(User).order_by(User.age).all() # users = session.query(User).order_by(User.age.desc()).all() session.close() return users
Please call me JiangYouDang!