[Tutor] UPDATE, pyhthon+postgre
nitin chandra
nitinchandra1 at gmail.com
Wed Jun 1 08:15:01 EDT 2016
Hello All,
I am writing a UPDATE statement, but am getting stuck with the following error.
Traceback (most recent call last):
File "/var/www/passtms/updateCutoff.cgi", line 70, in <module>
WHERE group_code = %s;""",
(name,add,add1,city,state_county,country,basic,todayDT,todayTIME,grpCode))
DataError: invalid input syntax for type timestamp with time zone: "05:27PM"
LINE 18: time_created='05:27PM'
^
Table created with the following lines :-
date_created date DEFAULT ('now'::text)::date,
time_created timestamp with time zone DEFAULT now()
With the code below, I am getting data from a HTML Form, and then I am
trying to update the single record in Pg Table
grpCode = form.getvalue('nameradio')
name = form.getvalue('name')
add = form.getvalue('add')
add1 = form.getvalue('add1')
city = form.getvalue('city')
todayDT = form.getvalue('todayDT')
todayTIME = form.getvalue('todayTIME')
cursor1.execute("""UPDATE employee SET
name=%s,
add=%s,
add1=%s,
city=%s,
state_county=%s,
country=%s,
basic=%s,
date_created=%s,
time_created=%s
WHERE group_code = %s;""",
(name,add,add1,city,state_county,country,basic,todayDT,todayTIME,grpCode))
How do I resolve this issue?
Thanks
Nitin
More information about the Tutor
mailing list