MySQLdb fetcall,AttributeError: 'int' object has no attribute 'fetchall'

Viewed 9038

I want to check if I have managed to import my csv file into MySQL db in proper manner.My code

import MySQLdb

mydb = MySQLdb.connect(host = 'localhost',user = 'milenko',passwd = 'nuklear',db = 'mm')
cur = mydb.cursor()
command = cur.execute('SELECT * FROM jul')
results = command.fetchall()

print (results)

But I got this

File "b12.py", line 6, in <module>
    results = command.fetchall()
AttributeError: 'int' object has no attribute 'fetchall'

I have seen previous SO posts,where people claim that number objects do not have fetcall object.I have copied this code from Python for MySQL from Albert Lukaszewski. How to pull down db content in one go?

1 Answers
Related