SQLAlchemy: How to Delete with join(SQLAlchemy:如何使用连接删除)
问题描述
我在用 SQLAlchemy 做这样的事情时遇到了麻烦:
I have trouble doing such thing bottom with SQLAlchemy:
作为这里的帖子:SQLAlchemy:使用创建删除查询MySQL 上的自联接
我很难在 SQLAlchemy 中使用 join 进行删除.
I've got it's hard to do delete in SQLAlchemy with join.
所以我现在是这样做的:
So I'm now doing like this:
但它只是让我很恼火:SQL 注入等.
But it just annoy me a lot like about: SQL Injection thing, etc..
有没有什么办法可以使用SQLAlchemy来解决这里的问题?谢谢!
Is there any way using SQLAlchemy to solve the problem here? Thanks!
推荐答案
SQLAlchemy 1.2 及更高版本 支持多表删除某些方言(在编写 Postgresql、MySQL 和 Microsoft SQL Server 时):
SQLAlchemy 1.2 and up support multi table deletes for some dialects (at the time of writing Postgresql, MySQL and Microsoft SQL Server):
同样使用 Session
和声明式:
and the same using a Session
and Declarative:
哪个会发出
这篇关于SQLAlchemy:如何使用连接删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!