[clug] mysql programming in python

Arjen Lentz arjen at lentz.com.au
Tue Nov 29 21:53:37 MST 2011


Hi Jeff

----- Original Message -----
> I'm writing an interactive python script which talks to a mysql
> database back end on the same machine. Using cursors is there a way
> to go backward to the previous record? There appears to fetchall(),
> fetchone(), fetchmany(), etc. Just trying to be lazy and not have more
> state stored in the program than necessary.

If you're using the MySQL server side cursors: they're read-only and forward-only.
If you're using a cursor mechanism implemented in the client code (Python), then it's responsible for keeping track of everything - it can read and not keep previous, or read and remember so you can step backward, or load everything in one hit and just eat memory but allow anything.


Cheers,
Arjen.
-- 
Exec.Director @ Open Query (http://openquery.com) MySQL services
Sane business strategy explorations at http://Upstarta.biz
Personal blog at http://lentz.com.au/blog/


More information about the linux mailing list