更新语句是这样的:
python
  result = Doctor.query\
            .filter(Doctor.department_id==department_id) \
            .filter(Doctor.id.in_(tuple(doctor_ids))) \
            .update({"department_id":None})
执行的时候报错
sqlalchemy.exc.InvalidRequestError: Could not evaluate current criteria in Python: "Cannot evaluate clauselist with operator 
解决方法是:
result = Doctor.query\
            .filter(Doctor.department_id==department_id) \
            .filter(Doctor.id.in_(tuple(doctor_ids))) \
            .update({"department_id":None}, synchronize_session='fetch')
关注公众号「Python之禅」,回复「1024」免费获取Python资源