更新时间:2022-05-15 00:59:56
查看一些我做了类似操作的代码,我相信这会满足您的要求.
Looking through some code where I did something similar, I believe this will do what you want.
d = addresses_table.delete().where(addresses_table.c.retired == 1)
d.execute()
在表对象上调用delete()
会给您一个sql.expression
(如果有内存的话),然后您可以执行.我在上面假设表已绑定到一个连接,这意味着您可以在其上调用execute()
.如果没有,您可以在连接上将d
传递给execute(d)
.
Calling delete()
on a table object gives you a sql.expression
(if memory serves), that you then execute. I've assumed above that the table is bound to a connection, which means you can just call execute()
on it. If not, you can pass the d
to execute(d)
on a connection.
在此处中查看文档>.