I have a very large table in mysql that I'm accessing through a python script, and I'd like the output of my select query to be stored as a list. Here's what I have:
import MySQLdb
db = MySQLdb.connect(host='', user='', passwd='', db='')
cursor = db.cursor()
sqlselect = "SELECT desig FROM table WHERE num=0;"
desigs = cursor.execute(sqlselect)
print desigs
But this just gives me the number of rows in set which is nearly 250,000. Instead, I'd like it to print a list of each 'desig'. How can I do this?
print [desig for desig in cursor]cursorand notdesigsright afterexecuteis called.