kennethreitz / records

SQL for Humans™
https://pypi.python.org/pypi/records/
ISC License
7.15k stars 570 forks source link

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

Open JohnnyXu opened 6 years ago

JohnnyXu commented 6 years ago

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.

vlcinsky commented 6 years ago

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

vlcinsky commented 6 years ago

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.

emacsuser123 commented 5 years ago

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.