Recently, I was looking for “best practices” for getting data from MySQL to a numpy array. Thanks to Tim Hochberg on the numpy mailing list, we get the following as the apparently fastest way to bridge the DB-numpy gap:
# CREATE TABLE demo (x REAL, y REAL)
c = conn.cursor()
c.execute('SELECT * FROM demo')
y = numpy.fromiter(c, dtype=[('a',float), ('b', float)])
At least, it was the fastest back in 2006.