Hi Dalia,
On 26/02/2013 17:15, dalia wrote:
self._get_file(content) ### This is a function which generates
the file (.xls / .doc / .pdf) in the content
What are you getting back from _get_file? Is it in a format you can
store in the db column and then restore it to a file?
Doing a bit of googling I found this on stackoverflow which looks
relatively simple, i.e. he suggest to use "open" with the 'rb' and 'wb'
flag for reading and writing.
http://stackoverflow.com/questions/3379166/writing-blob-from-sqlite-to-file-using-python
You should be able to just use the non sqlite3 part of this, i.e.
something like:
|with open("yourfilename", "rb") as input_file:
tbl.report_file= input_file.read()
with open("Output.bin", "wb") as output_file:
output_file.write(|||tbl.report_file|)|
I personally just store the file name/path and keep the data on the
disk, but there are obviously reasons to put it in a db. You might want
to read some of the other posts on stackoverflow, e.g.:
http://stackoverflow.com/questions/3748/storing-images-in-db-yea-or-nay
Werner
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.