SQLAlchemy如何筛选值为None的列?

示例

from sqlalchemy import create_engine, MetaData, and_, or_, TIMESTAMP
Plugin.query.filter(and_(Plugin.job_name == job_name, or_(Plugin.group_id.is_(None), Plugin.group_id == delete_list[0]),
                        Plugin.plugin_name == delete_list[1], Plugin.plugin_version == delete_list[2],
                        Plugin.plugin_state == delete_list[3])).delete()

更多操作符

见/Users/xxx/.virtualenvs/erebus_app/lib/python3.6/site-packages/sqlalchemy/sql/operators.py
比如:startwith/endwith/contains/asc/desc/is_/isnot

猜你喜欢

转载自www.cnblogs.com/shengulong/p/11006895.html