I have below python code as sql query to update a record in table:
query = "UPDATE mytable SET data='{}' where id='{}'".format(value, id)
This updated the record in table. Now I have another query which include datetime:
send_dt = datetime.utcnow()
query = "UPDATE mytable SET data='{}', send_datetime='{}' where id='{}'".format(value, send_dt, id)
Now because I have include send_dt
inside format, it is making the type datetime to string and thus I am getting below error:
Conversion failed when converting date and/or time from character string.
How can I update my query so that datetime remains datetime and not string. Thanks