I followed (two) examples in this question: SQLAlchemy: best way to upgrade with declarative?
And I found that the model update does not happen when using sqlite with flask-sqlalchemy on Ubuntu Linux. The simplest example doesn't work for me:
class Task: id= db.Column(db.Integer, primary_key=True) name= db.Column(db.String(32), unique=True) desc= db.Column(db.String(255), unique=False) state= db.Column(db.Boolean) # ... @app.route("/task/<int:id>/update",methods=["POST"]) def toggle_state(id): db.session.query(Task).get(id).update({"state":True}) log.info("state is now: " + str(Task.query.get(id).state)) # prints "state is now: False"
For the first time, using the / sqlalchemy flask, so I guess I'm missing something obvious.
Kevin source share