Reputation: 565
import mysql.connector
cnx=mysql.connector.connect(user,password,host,database)
cursor=(cnx.cursor)
and, i am trying to query the database twice with different queries as below
query1result=[]
query2result=[]
cursor.execute(query1)
for each in cursor:
query1result.append[each]
cursor.execute(query1)
for each in cursor:
query1result.append[each]
I get an error at python/mysql/connector/cursor.py. line 474
I want to know what is the right way for multiple queries.
Upvotes: 7
Views: 20974
Reputation: 565
found it here:
http://dev.mysql.com/doc/connector-python/en/connector-python-example-cursor-transaction.html
the same would be for querying too..
Upvotes: 5