B
B
beduin012016-05-28 16:10:36
Python
beduin01, 2016-05-28 16:10:36

What is streaming mode in Python?

I can't figure out the documentation for FireBird.
I need to understand how binary blobs are inserted, but the examples say:
Materialized
Streamed
And then instead of reading the file they write:
cur.execute("insert into blob_test values ​​(?)", ('abcdef',) )
How can I upload a file here?
I do:

output_file_name_read = open(output_file_name,'rb').read() 
currDst.execute("""UPDATE "REQUESTS" SET shape = {0} WHERE request_id = 2""" % output_file_name_read)

I am getting an error:
File "C:\work\App.py", line 70, in <module>
    main()
  File "C:\work\App.py", line 67, in main
    SyncRequest(postconn, fireconn, 'POSTID', 'FIREID')
  File "C:\work\App.py", line 52, in SyncRequest
    currDst.execute("""UPDATE "REQUESTS" SET shape = {0} WHERE request_id = 2""" % output_file_name_read)
TypeError: not all arguments converted during string formatting

Tried like this:
currDst.execute("UPDATE REQUESTS SET shape = ? WHERE request_id = 2", (output_file_name_read))
TypeError: parameters must be list or tuple

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kitaev, 2016-05-28
@deliro

(output_file_name_read) is not a tuple
(output_file_name_read,) is a tuple

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question