Re: [sqlalchemy] StaleDataError on simple update statement

2023-04-26 Thread Mike Bayer
this can happen if you are using the wrong datatype for your primary key. like it's a string in the database and you are referring to it as an Integer, that kind of thing. no way to provide more detail without seeing a short version of the mapping that produces this error and CREATE TABLE stat

[sqlalchemy] StaleDataError on simple update statement

2023-04-26 Thread Mirel Glejser
I am completely stumped after working on this issue for 2 days. I am simply querying a user, updating the name, and sending it back to the database. user = session.query(User).get(1) user.first_name # John user.first_name = 'Sally' session.commit() # > sqlalchemy.orm.exc.StaleDataError: UPDAT