I want to update a DATE type column called file_date in mysql table from python code. I have a string date like this a='2020-02-20'. When I tried in multiple ways, always I'm getting similar to this below error,
mysql.connector.errors.DatabaseError: 1411 (HY000): Incorrect datetime value: '1998' for function str_to_date
I don't know from where this 1998 coming from. My sample code is given below
import mysql.connector
a='2020-02-20'
insert_qry="insert into table_name(file_date) values(STR_TO_DATE({},'%Y-%m-%d'))".format(a)
#assume I have a db_cursor created to connect mysql server
db_cursor.execute(insert_qry)
Point me where it went wrong. Thanks in advance.