I have trouble doing such thing bottom with SQLAlchemy:
DELETE a FROM a INNER JOIN b ON b.`aId` = a.`Id` WHERE `b`.`xxx` = ?;
As the post here: SQLAlchemy: Create delete query using self-join on MySQL
I've got it's hard to do delete in SQLAlchemy with join.
So I'm now doing like this:
session.execute('DELETE a FROM a INNER JOIN b ON b.`aId` = a.`Id` WHERE `b`.`xxx` = %d;'%xxx)
But it just annoy me a lot like about: SQL Injection thing, etc..
Is there any way using SQLAlchemy to solve the problem here? Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…