Within an Flask app I'm polling my database waiting for an given record to appear:
for i in range(10):
shop = Shop.query.filter_by(id=shop_id).one_or_none()
if shop:
# break and do something
sleep(60)
However even if the shop record appears, the query always gives None (if the first iteration was None), even if the same SQL query return an object. It almost looks like SQLalchemy (1.3) uses some kind of caching instead of really executing evaluating the result of the query!
The same behavious is true in the opposite direction as well i.e. if the shop record is deleted from the database.