Mysql Timestamp Data Truncated For Column
I'm attempting to use python to insert a timestamp into column created_by of a mysql db. Here is my database table setup.. CREATE TABLE temps ( temp1 FLOAT, temp2 FLOAT, created_
Solution 1:
You should have to set the datetime. Your created_at column will automatically be updated to the current time stamp at insertion. See documentation at Automatic Initialization and Updating for TIMESTAMP.
You statement should be
cursor.execute("""INSERT INTO temps VALUES (%s,%s,CURRENT_TIMESTAMP)""",(avgtemperatures[0],avgtemperatures[1]))
Post a Comment for "Mysql Timestamp Data Truncated For Column"