title: caching mysql query returned by Python script
body: <p>I have this python '2.6.4' script:</p>
  
  <pre><code>#!/usr/bin/python
  import MySQLdb
  import csv
  import pprint
  
  db = MySQLdb.connect(host="localhost", # The Host
                       user="username", # username
                        passwd="password", # password
                        db="dbname") # name of the data base
  
  cursor = db.cursor() 
  
  cursor.execute("SELECT name, id, city, storeid FROM Products;")
  
  StudentsData = cursor.fetchall()
  pprint.pprint(StudentsData)
  </code></pre>
  
  <p>this query return millions of rows, and it takes <code>3 minutes</code> to execute, and it run 20 times a day, and everyuser has to wait three minutes to fetch the output.    </p>
  
  <p>I was thinking about <code>caching</code> it, but I don't know how to do that in python, 
  will that be a good idea, if so how can I do it, using the obove code.    </p>
  
  <p>please help me if there's  a better way to do this?</p>