I am using Python3 and MySQL. I have a string value in date and time format (dateS).
import datetime
dateS = datetime.datetime.strptime(s, '%Y-%m-%d %H:%M:%S')
# print(dateS) # 2018-08-27 00:30:00
I need to delete rows in table "bts_l3_single_value_data" checking with the condition where start_time is equal to mentioned datetime.
sql = """DELETE FROM bts_l3_single_value_data WHERE start_time = dateS"""
When I execute this I'm getting an error as " Error: (1054, "Unknown column 'dateS' in 'where clause'") " and when I print the sql statement it gives as;
DELETE FROM bts_l3_single_value_data WHERE start_time = dateS
without converting the dateS string to datetime format.
Any help. Thanks