I’m trying to add data to a table (test_copy) using the MySQLdb executemany command, as follows:
db = mdb.connect(host="127.0.0.1",port=3306,user='XXXX',db="test")
cursor = db.cursor()
COM = "insert into test_copy (Short_Model) VALUES (%s)"
VALS = ['213','3232','fd','sadad']
cursor.executemany(COM,VALS)
cursor.close
Note: Name of Table = test_copy, Column Name = Short_Model
Problem is that the command runs without any errors but when I check the table no data has been added.
Apologies if this is an easy problem but it’s driving me crazy for the last few hours.
Thanks.
Thank you @Jon Clements and @Abhishek Mishra – You have returned my sanity. Here is the final solution for those interested: