0

I am trying to execute a python script.

Script:

   dt = datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")
    mycursor.execute("INSERT INTO photos(id,name,type,updated_at_ms) values("+str(id)+","+json.dumps(url)+",1,'%s');".format(dt))
    self.mydb.commit()

The script runs successfully, but the timestamp doesn't get populated. The value for the timestamp is "0000-00-00 00:00:00.000" across all rows.

The variable has a value which I checked with the Print statement but somehow it won't work with an Insert statement.

Please let me know what am I missing here.

Thank you in advance.

0 Answers0