Posts Categorized : Uncategorized

Drop us a line...

I wasted some time today with python to find out how to create an unbuffered cursor for pymysql, which i use to connect to MySQL dbs instead of MySQLdb.

By default pymysql fetch all the rows of your SELECTs, even if you use fetchone instead of fetchall, because by default when you create a pymysql cursor with connection.cursor() the cursor is a buffered one.

The unbuffered cursor is really useful, and sometimes necessary, if you need to get a large amount of data. In order to do so: