postgresql - "ProgrammingError: syntax error at or near" when executing query in python using psycopg2 -


i running python v 2.7 , psycopg2 v 2.5 have postgresql database function returns sql query text field.

i using following code call function , extract query text field.

cur2.execute("select * historian.generate_get_archive_data_sql(%s, '*',public.get_dcs_datetime_from_timestamp(%s),public.get_dcs_datetime_from_timestamp(%s))",(row,old_time,current_time)) while true: #indefinite loop     row2 = cur2.fetchone()     query2 = str(row2)     cur3.execute(query2) 

i seem getting following error when running script,

programmingerror: syntax error @ or near "'select * historian._73b4f984f30b4c68a871fac1c53a1b8f_45907294814208000 archive_datetime between 45907381384722560 , 45907381384732560 order archive_datetime;'" line 1: ('select * historian.73b4f984f30b4c68a871fac1c53a1b8f...

when run query on postgresql server executes fine. can me understand doing wrong ? . thanks.

it'd add more clarity if describe table schema in question.

the mistake either of following parameters using string formatting none.

(row,old_time,current_time) 

please check code resolve same.


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -