SQLAlchemy: How do you delete multiple rows without querying

后端 未结 3 1588
小鲜肉
小鲜肉 2021-01-31 02:11

I have a table that has millions of rows. I want to delete multiple rows via an in clause. However, using the code:

session.query(Users).filter(Users.id.in_(sub         


        
3条回答
  •  不思量自难忘°
    2021-01-31 03:01

    To complete dizzy's answer:

    delete_q = Report.__table__.delete().where(Report.data == 'test')
    db.session.execute(delete_q)
    db.session.commit()
    

提交回复
热议问题