Here is the snippet of code I am having problem with
for x in myresult:
    sql = "INSERT INTO `writing_correction` (`autoinc`, `q_usage_id`, `ruleId`, `message`, `replacements`, `offset`, `errorLength`, `category`, `ruleIssueType`) VALUES (NULL, %d, %s, %s, %s, %d, %d, %s, %s )"
#    sql = "INSERT INTO customers (name, address) VALUES (%s, %s)"
#    sql = "INSERT INTO `writing_correction` (`autoinc`, `q_usage_id`, `ruleId`, `message`, `replacements`, `offset`, `errorLength`, `category`, `ruleIssueType`) VALUES (NULL, '100', 'ruleid', 'message', 'replacemenet', '12', '3', 'cat', 'ruleissuetype')"
#    val = ("John", "Highway 21")
#    mycursor.execute(sql, val)
    print(x[3])
    matches = tool.check(x[3])
    for y in matches:
#        sql = "INSERT INTO `writing_correction` (`autoinc`, `q_usage_id`, `ruleId`, `message`, `replacements`, `offset`, `errorLength`, `category`, `ruleIssueType`) VALUES (NULL, %d, %s, %s, %s, %d, %d, %s, %s )" % ( x[0], y.ruleId, y.message, y.replacements, y.offset , y.errorLength, y.category, y.ruleIssueType )
        val = ( [ x[0] ], (y.ruleId), (y.message), (y.replacements), [y.offset] , [y.errorLength] , (y.category), (y.ruleIssueType) )
        print(val)
#        mycursor.execute(sql , ( x[0], y.ruleId, y.message, y.replacements, y.offset , y.errorLength, y.category, y.ruleIssueType ) )
        mycursor.executemany(sql, val)
the commented code is my trial and error attempt to make it work but it is not working for some reason.
Currently I am getting following error:
File "/usr/local/lib/python3.8/dist-packages/mysql/connector/cursor.py", line 75, in __call__
    return bytes(self.params[index])
IndexError: tuple index out of range
 
     
    