SQLAlchemy Bulk update with custom where clause

半世苍凉 提交于 2019-12-11 17:58:54

问题


using bulk_update_mappings, the approach is:

All those keys which are present and are not part of the primary key are applied to the SET clause of the UPDATE statement; the primary key values, which are required, are applied to the WHERE clause.

Is there any way to change this rule?
I mean to specify a custom where clause as:

update Bar set name='a' where family='b' and code = 10
update Bar set name='b' where family='c' and code = 11
update Bar set name='c' where family='d' and code = 12
........
update Bar set name='aaaa' where family='bbbb' and code = 10000

来源:https://stackoverflow.com/questions/57534134/sqlalchemy-bulk-update-with-custom-where-clause

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!