---------- Forwarded message ----------<br>From: David Sfiligoi <<a href="mailto:sfiligoi@gmail.com">sfiligoi@gmail.com</a>><br>To: <a href="mailto:python-list@python.org">python-list@python.org</a><br>Date: Tue, 20 Oct 2009 21:41:10 -0500<br>
Subject: mysql select some sort of caching<br>Hi<br>
I am normally an SQLlite person because it just works... but I decided to<br>
keep inproving my skills set and do my new project using a MySQL database<br>
backend because of the architecture decision I made(horizontal scalable<br>
system via message queues). The project is architected around a rabbitmq<br>
system with bunch of consumers(potentially large) and publishers... I<br>
digress, the rabbit has a no part to play in my myunderstanding with<br>
mysql.<br>
<br>
I have a consumer that get data from a queue(a url). This queue is<br>
checked in a loop. Once a url has been published in the queue, the<br>
consumer sees it and call a function to do something with it. Using a<br>
column in the table I verify if 'today's task' has been done already<br>
(compare the current date to the last task date that I store in the table<br>
last time I executed the task)<br>
<br>
So normally I would open a connection and instentiate a cursor for my<br>
queries once at a global level(like find out if the current date is ><br>
than the last task date). Then go in an infinite loop that wait for data<br>
to arrive in the queue and carry the cursor and connection over. However<br>
this is the issue I seem to run into. I test the code by zapping, using<br>
mysql query tools, the table's last task date column with an older date<br>
so that current date is larger than the current date. Issue is that<br>
whatever prior date I put in the table's last task date colum somehow<br>
they are not seen by the SELECT query<br>
sqlcur.execute("SELECT `url`d` from `url_snapshot` WHERE `url` = %s and<br>
`lastsnapshotdate` < %s",(url,currentdate))<br>
that query returns old data.<br>
<br>
Just like if the query is cached....yet the data actually changed in the<br>
database.<br>
<br>
However when I recreate a new connection and cursor everytime I get a new<br>
message in the queue(url), therefore within the message found loop there<br>
are no issues seeing the last update done via the mysql query tool<br>
<br>
I don't think this has to do with mysql caching features since its<br>
suppose to detect when the fields changed.<br>
<br>
Any ideas?<br>
<br>
Thanks for your Time,<br>
David<br><br>---------- Forwarded message ----------<br><br>A simple suggestion.. in your next post - go direct to your problem.<br><br>Just to be sure, did you got a "commit"!?<br><input id="gwProxy" type="hidden"><input onclick="jsCall();" id="jsProxy" type="hidden"><div id="refHTML">
</div>