I moved `db.session.commit()` outside the loop. That seemed to fix the
error. I'll post an update if I get more errors.
On Wednesday, December 20, 2017 at 6:43:05 PM UTC-5, Lele Gaifax wrote:
>
> Tom Tanner <dontsende...@gmail.com > writes:
>
> > I want to query row
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
Thank you
On Wednesday, December 20, 2017 at 8:37:57 AM UTC-5, Lele Gaifax wrote:
>
> Tom Tanner <dontsende...@gmail.com > writes:
>
> > Lele, could you write the code showing how that would look? Thanks.
>
> Extending Mike's answer:
>
> from sql
Lele, could you write the code showing how that would look? Thanks.
On Wednesday, December 20, 2017 at 2:22:49 AM UTC-5, Lele Gaifax wrote:
>
> Tom Tanner <dontsende...@gmail.com > writes:
>
> > Thanks, I used the first method. Follow up question: How do I get the
> ne
Thanks, I used the first method. Follow up question: How do I get the new
primary key after running `session.commit()`?
On Tuesday, December 19, 2017 at 11:29:34 AM UTC-5, Mike Bayer wrote:
>
> On Tue, Dec 19, 2017 at 3:02 AM, Tom Tanner
> <dontsende...@gmail.com > wrote:
I'm using SQLAlchemy with the Python library Flask.
How do I query an object from a database, make a copy of it, and save that
copy to the database?
Example of querying an object.
someObj = db.session.query(SomeDataTable).filter_by(id=someID).first()
I want to save a copy of `someObj` to the