Deleting an Object from Collection in SQLAlchemy

后端 未结 2 387
抹茶落季
抹茶落季 2021-01-13 10:52

I am storing a bunch of patent data in a MySQL database and interacting with it via SQLAlchemy. I have a collection inside the Patent class that represents the list of assi

2条回答
  •  [愿得一人]
    2021-01-13 11:25

    SQLAlchemy collections support list-like append/remove operations.

    p.assignees.remove(c)
    

    This should remove c form p.assignees without deleting c from database.

提交回复
热议问题