Where is the error in the query to insert the data into Postgres?

Here is my code:
output_file_name_read = open(output_file_name,'rb').read() # where we wrote, then read
 # SQL_update_request = """UPDATE "REQUESTS" SET shape = {0} WHERE request_id = 6""".format(psycopg2.Binary(output_file_name_read))
 currDst.execute("""UPDATE "REQUESTS" SET shape = %s WHERE request_id = 7""", psycopg2.Binary(output_file_name_read))
 postconn.commit()


At startup I get this error:

Traceback (most recent call last):
 File "C:\work\App.py", line 67, in <module>
main()
 File "C:\work\App.py", line 64, in main
 SyncRequest(postconn, fireconn, 'POSTID', 'FIREID')
 File "C:\work\App.py", line 49, in SyncRequest
 currDst.execute("""UPDATE "REQUESTS" SET shape = %s WHERE request_id = 7""", psycopg2.Binary(output_file_name_read))
 File "C:\Python27\ArcGIS10.1\lib\site-packages\fdb\fbcore.py", line 3322, in execute
 PreparedStatement(operation, self, True))
 File "C:\Python27\ArcGIS10.1\lib\site-packages\fdb\fbcore.py", line 1934, in __init__
 "Error while preparing SQL statement:")
fdb.fbcore.DatabaseError: ('Error while preparing SQL statement:\n - SQLCODE: -104\n - Dynamic SQL Error\n - SQL error code = -104\n Token unknown - line 1, column 31\n- %', -104, 335544569)</module>


What am I doing wrong?
July 9th 19 at 11:00
1 answer
July 9th 19 at 11:02
And where is substituted in the query the value of %s ?
Isn't here:
", psycopg2.Binary(output_file_name_read)" - paula.Ste commented on July 9th 19 at 11:05

Find more questions by tags PostgreSQLPython