I have a function that does the following:
cursor.execute('SELECT runtime, fingerprint FROM itemstable')
items = cursor.fetchall()
for item in items:
do_something()
It takes about 3s to return the SQL query because there are 500k results or so and the data is about 500MB. I run this operation about a few million times per day, so would like to have the items
object in memory, so I can grab it when I run the operation. Something like:
items = get_item_from_daemon(name='FingerPrint') # loaded instantly, in memory
for item in items:
do_something()
How would I do this? Note that I am using python2.7.