I am trying to insert a date inside the orderDate column in my sql database, which is of datatype date
date = (start_date.strftime("%Y-%m-%d"))
testData.cur.execute("INSERT INTO customerOrders (orderDate) VALUES %s", (date,))
testData.cn.commit()
Here is the value of the variable 'data':
2019-01-01
Here is the data type of the date:
class 'str'
I am subject to the error of:
mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2019-01-01'' at line 1