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
Avatarkundan asked 4 months 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
AvatarAmit answered 4 months ago
Your Answer

5 + 0 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com