SQLAlchemy clone table row with relations
sqlalchemy
Solution
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.
Problem
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 original object had. Is there a way to copy the object and any many-to-many relationships as well? Cheers!