records icon indicating copy to clipboard operation
records copied to clipboard

db.query is not consistent with DB when new data insert/delete in DB

Open JohnnyXu opened this issue 7 years ago • 3 comments

does records or SQLAlchemy cache require result? I find that once when new data insert/delete in DB, the same db.query still return old result. it can find the new data, only after I re-launch the process.

JohnnyXu avatar Apr 25 '18 11:04 JohnnyXu

Can you provide more details? Data, database, queries, operations between queries...

vlcinsky avatar Apr 26 '18 21:04 vlcinsky

Reading the records.py code shows, a cache is in place and there is no place, where it would get invalidated.

Scenarios using insert/delete/update shall invalidate current cache so implementing this shall resolve this issue.

vlcinsky avatar Apr 28 '18 20:04 vlcinsky

Yeah, I have found that doing the insert/update/delete out of the code (for instance, using plain mysql client) makes that the current connection created with records library does not see it, as expected, even if I execute a new "select *" statement, because of the cache. The only way I have found to invalidate the cache is to close the connection and reconnect again, which seems quite expensive in terms of resources.

emacsuser123 avatar Nov 19 '18 05:11 emacsuser123