mysql select some sort of caching
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Tue Oct 20 23:45:21 EDT 2009
En Tue, 20 Oct 2009 23:41:10 -0300, David Sfiligoi <sfiligoi at gmail.com>
escribió:
> whatever prior date I put in the table's last task date colum somehow
> they are not seen by the SELECT query
> sqlcur.execute("SELECT `url`d` from `url_snapshot` WHERE `url` = %s and
> `lastsnapshotdate` < %s",(url,currentdate))
> that query returns old data.
>
> Just like if the query is cached....yet the data actually changed in the
> database.
If you want to keep the cursor open, you must commit the (implicit)
current transaction, even if it only contains selects (a rollback would
work too).
Alternatively, lower the transaction isolation level below "repeatable
reads". Note that in other scenarios, ensuring that the same query returns
the same results is a Good Thing.
--
Gabriel Genellina
More information about the Python-list
mailing list