mardi 4 novembre 2014

Copy just the data columns from a SQLAlchemy object


Vote count:

0




I have an object



esc = Escalation.query\
.filter(Escalation.esc_id == esc_id).first()


And I would like to copy all of the columns except the primary key and foreign keys so that I can make a new copy of this object in the database with new relationships.


Currently I just make a constructor that can take a Escalation instance so I can say



new_esc = Escalation(esc)


but I was wondering if there is a built in feature for SQLAlchemy that solves this problem. I looked at session.merge but I don't want to take the entire state.



asked 38 secs ago







Copy just the data columns from a SQLAlchemy object

Aucun commentaire:

Enregistrer un commentaire