Re: [sqlalchemy] KeyError when looping thru class objects to try and copy them

2017-12-20 Thread Mike Bayer
On Wed, Dec 20, 2017 at 5:38 PM, Tom Tanner wrote: > I want to query rows and copy them while changing an attribute of each. > Here's my code. > > colObjs= db.session.query(Column).filter_by(chart_id=oldChartID).all() > for colObj in colObjs: >make_transient(colObj) >print colObj.id >

[sqlalchemy] KeyError when looping thru class objects to try and copy them

2017-12-20 Thread Tom Tanner
I want to query rows and copy them while changing an attribute of each. Here's my code. colObjs= db.session.query(Column).filter_by(chart_id=oldChartID).all() for colObj in colObjs: make_transient(colObj) print colObj.id del colObj.id colObj.chart_id= newChartID db.session.add(co