How to iterate through cursor after mysql select * query in python?

Multi tool use


How to iterate through cursor after mysql select * query in python?
I am querying all the fields of a mysql table like this -
query = """select * from %s where %s=%s;""" % (tableName,key,value)
cursor.execute(query)
Now, I would like to iterate over the results. I do not want to specify the column names which I would like to fetch as I would like to fetch all. This is part of a generic migration verification script which is supposed to do the verification for all the mysql tables. Since there will be different number of columns in different tables, I would like a general solution.
I checked https://stackoverflow.com/a/25347195/351903 but it involves specific fields.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.