Try to search your question here, if you can't find : Ask Any Question Now ?

Flask-SQLAlchemy not saving database updates

HomeCategory: stackoverflowFlask-SQLAlchemy not saving database updates
kundan asked 6 days ago

I am trying to import data into existing database items. There are two fields that I want to update for each data base item: a string type field caled imagefolder and a picketype (list) field called images. The input values for both fields are strings that store file paths.

My steps are to query the database item, check for its existance, and then update its fields.

blend = Blend.query.filter_by(old_ID=row[4]).first()
if blend:
    blend.imagefolder = "/".join((row[16].split("/")[4:])[:-1])
    blend.images.append(ntpath.basename(row[16]))
    db.session.commit()

When I run the script nothing happens (the database doesn’t update), and I noticed that the import script runs really quickly, too quickly.

1 Answers
Best Answer
Amit answered 6 days ago
Your Answer

4 + 10 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com