[sqlalchemy] StaleDataError on UPDATE for a DATETIME field on multiple consecutive requests

2023-09-01 Thread Dumitru Gîra
I have encountered a very strange behaviour and I don't know where to look further. I have a small API https://pastebin.com/qW01jNz8 with 2 endpoints: one to update the name (VARCHAR) and one to update the last_login (DATETIME). If I make 10 consecutive requests to /update-string - everything

Re: [sqlalchemy] StaleDataError on UPDATE for a DATETIME field on multiple consecutive requests

2023-09-01 Thread Mike Bayer
a stale data error with date/time fields is usually a mismatch between the date/time value you have locally and the one that's in the database,. assuming you are using the datetime column as a "version_id" in your mapping. Issues like strings vs. datetimes and/or microseconds portions being

Re: [sqlalchemy] StaleDataError on UPDATE for a DATETIME field on multiple consecutive requests

2023-09-01 Thread Dumitru Gîra
Hi Mike, thanks for the quick response. These would be the debug logs for import requests for i in range(2): r = requests.put('http://0.0.0.0:8080/update-datetime') print(r.text, r.code) 2023-09-01 16:06:20,711 INFO sqlalchemy.engine.Engine SELECT DATABASE() 2023-09-01 16:06:20,711 INFO

Re: [sqlalchemy] StaleDataError on UPDATE for a DATETIME field on multiple consecutive requests

2023-09-01 Thread Mike Bayer
unless the row is being deleted, this would possibly be a driver bug. the pymysql driver should work pretty well whereas mysql-connector I would stay away from.I would need more detail to reproduce beyond that, the SQL statement has nohting wrong with it. On Fri, Sep 1, 2023, at 12:09 PM,