Answer the question
In order to leave comments, you need to log in
Is there a saveOrUpdate hibernate equivalent in flask-sqlalchemy?
Hello.
If there is no entry with a certain id, I need to write it down, if there is, update it with new data.
Is there an analogue of saveOrUpdate hibernate in flask-sqlalchemy ?
Answer the question
In order to leave comments, you need to log in
stackoverflow.com/questions/5442825/save-or-update...
update(), save_or_update(), save() are all deprecated. add() places an object in the session in all cases, using the persistence information already associated with the object to determine INSERT or UPDATE. this means if you just make a new Foo(id=some id), that's transient - SQLAlchemy didn't load it. It will be INSERTed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question