i am trying to insert a record of time-type variable called duration that is gotten by using the datetime package..
duration_start_time = datetime.now()
time.sleep(5)
duration_end_time = datetime.now()
duration = duration_end_time - duration_start_time
print(f"{fileName} took", duration, "to download")
insert_duration = "INSERT INTO ImportHistory(Duration) VALUES (%s)"
mycursor.execute(insert_duration, duration)
connection.commit()
the error i am getting is 'ValueError: Could not process parameters'
does anyone have any idea what i am doing wrong? let me know if i can clarify any necessary information i might've missed!
The argument must be a tuple, even if there's just one parameter:
mycursor.execute(insert_duration, (duration,))