I am attempting to INSERT INTO using a correct SQL query and Python's PyMySQL package. I know it is correct since the same query, when doing a Copy/Paste into mySQL workbench, inserts it all right!
However, using Python's pymysql package and cursor.executemany() it fails silently, and returns as rowcount minus 1 (-1).
Here is the piece of code:
ins_query = "REPLACE INTO `household`.`expenses`(`ID`,`Date`,`Sum`,`Class`,`Description`,`Necessity`) VALUES (NULL,'2021-12-23', 800, 'Groceries','Test-3',NULL )"
# ------------------------------
cursor = self.conn.cursor()
try:
cursor.executemany(ins_query)
except pymysql.Error as e:
print("Error %d: %s" % (e.args[0], e.args[1]))
return False
self.conn.commit()
return cursor.rowcount