SQLAlchemy clone table row with relations

前端 未结 2 1833
不知归路
不知归路 2020-12-16 21:24

Following on from this question SQLAlchemy: Modification of detached object.

This makes a copy of the object fine, but it loses any many-to-many relationships the or

2条回答
  •  长情又很酷
    2020-12-16 22:08

    I got this to work by walking the object graph and doing the expunge(), make_transient() and id = None steps on each object in the graph as described in SQLAlchemy: Modification of detached object.

提交回复
热议问题