I have an int list list = [1, 2, 3]
And a mysql table with an empty second column:
key value
a
b
c
I want to populate the value column with values from my list so as to make the table look like this:
key value
a 1
b 2
c 3
But I am always getting a TypeError: 'int' object is not iterable
My python code is:
conn = MySQLdb.connect(host="localhost", user="root", passwd="root")
cursor = conn.cursor()
list = [1, 2, 3]
cursor.executemany("INSERT INTO my_table (value) VALUES %d", list)
How am I to solve the issue and get the empty column populated? Thanks!
P.S.: this is just a sample. In reality, the list and the table are much bigger.