I am attempting to insert a Date, Time, and Temperature value from sensors I have installed in the field. I have all the computations and variables working as intended but the sql statement fails. Here is the a rough format of how the argument is formatted:
arg=('2019-07-21', '07:00:00', 29.323330729166656)
My SQL table is formatted as follows:
Date (as DATE), Time (as TIME), Temperature (as DOUBLE)
However, the insert into statement fails due to the standard 1064 error in MariaDB. " (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':00:00,29.323330729166656)' at line 1")"
Here is the SQL statement:
for row in arg:
print(row)
cursor.execute("INSERT INTO flirtest (Date, Time, Temperature) VALUES (%s,%s,%s)" % row)
db.commit()
I think this error is due to the quotes around the first two variables. But I am honestly not sure. How should these statements be properly formatted in python? Should quotes be included or not?