SQLAlchemy中in_列表和not in_列表的使用

SQLAlchemy中in_列表和not in_列表的使用

session.query(MyUserClass).filter(MyUserClass.id.in_((123,456))).all()
query = db_session.query(User.id, User.name).filter(not_(User.id.in_([123,456])))
results = query.all()
Use ~ (~User.id.in_([123,456])) or not_ from sqlalchemy.sql.expression(not_(User.id.in_([123,456]))).
Top