I have all my value in a form of list of lists my_list = [[...][...]etc.]
I set up a function to update some values in the existing database
def sql_update(my_list_int): #my_list_int is an integer value that would call the list that I need
db = MySQLdb.connect(host = 'my_host', user = 'my_user',
passw='my_pass', dd='my_db')
sql = """UPDATE my_database SET col2 = %s WHERE col1 = %s"""
cursor.execute(sql, (my_list[%s][2], my_list[%s][1] ))
db.commit()
cursor.close()
Everything runs when my_list_int = 0
or1
or2
. But for any other value I get
OperationalError: (1205, 'Lock wait timeout exceeded')
When I run it again immediately with no changes I get
IntegrityError: (1062, "Duplicate entry")
I can't figure out where is my mistake