import mysql.connector cnx = mysql.connector.connect(user='iot', password='userpar1', host='127.0.0.1', database='iot') cursor = cnx.cursor() cursor.execute("SELECT id, nimi, asukoht FROM seade ") for data in cursor: print(data) cursor.execute("SELECT * FROM EVENT") for data in cursor: print(data) cursor.execute("INSERT INTO `event`(`seade_id`, `date`, `event`, `value`) VALUES ('a421','38475453','Valgus',600)") cnx.commit() cursor.close() cnx.close()