So after my research on stackoverflow didn't bring me any further here ist my code (I cannot post the exact code , because this is a problem I have at work) and problem:
import mysql.connector
.
.
.
cnx = mysql.connector.connect(user, password, host, database)
cursor = cnx.cursor()
for-loop:
if condition:
cursor.execute("INSERT INTO table (the_columns) VALUES (%s)", (my_values))
cnx.commit()
I tried to insert manually already and it worked, but somehow my python code won't do the insert.
The manual insert:
INSERT INTO table (column1,...,column7) VALUES (string1,....,string6, now())
I have no error message, I can only look into the database and see that the new valiues aren't there. Did anyone else face this problem? Can anyone suggest what could be the problem?
cursor.commit()before closing the connectioncnx.close(), as said here with explanation.