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 works as
expected.
If I make 10 consecutive requests to /update-datetime - the first request
works and other 9 fail with sqlalchemy.orm.exc.StaleDataError.
NOTE: putting a time.sleep(1) after every request does not raise the error
Consecutive requests are being made using the simple snippet
import requests
for i in range(10):
r = requests.put('http://0.0.0.0:8080/update-datetime')
print(r.text, r.code)
The source code and the logs are in above link and for the reference I am
using:
- MySQL 8.0, but the same happens with 5.7
- mysqldb connector, but the same happens with pymysql
- SQLAlchemy==1.4.49
Is this related to MySQL and specifically to date/time related fields (as
the same happens with TIMESTAMP) or can it be something from SQLAlchemy
side?
Any directions would be highly appreciated.
Kind regards,
Dumitru
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sqlalchemy/e53169bd-617f-41f3-b9d3-8002ea75496an%40googlegroups.com.