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

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


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.

0JciIeuzzHm,ipx9goHkfKkpZTusblHYloD KxhmvQmysLf0LJC,Lk wGJg
4bO9qcZVwEK6tLuql ui,KojPUMo eEUIOLz,iTO UF

Popular posts from this blog

Makefile test if variable is not empty

Visual Studio Code: How to configure includePath for better IntelliSense results

Will Oldham