There is a web application written in Flask and Flask-SQLalchemy. It uses the following model:

class Event(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.Text) owner = db.Column(db.Integer, db.ForeignKey(User.id)) tags = db.Column(db.Text) 

And there is a function that should change the value of one of the fields of this model:

 def change_event_tags(_id, new_tags): new_tags = "sample" event = Event.query.filter_by(id=_id).update(dict(tags=new_tags)) db.session.commit() 

At run time, the function throws an 'Event' object has no attribute '_sa_instance_state' exception 'Event' object has no attribute '_sa_instance_state' . What is the reason for this and how to fix it? Here is the debug output debug

  • one
    Add to the error and the track, then it will be clearer where it fell - gil9red
  • @ gil9red did. - Ivan

0