Re: [sqlalchemy] Storing and Retrieving BLOB in SqlAlchemy

2013-02-27 Thread dalia
Hi Mauricio, Werner, Michael, Thank you for your replies. I understand storing the files in file system might be an easier option, but that would be my last option. If I can make it work with the database, I've got good reasons to go with it. I'm not trying to store an exisitng physical file

Re: [sqlalchemy] Storing and Retrieving BLOB in SqlAlchemy

2013-02-27 Thread Simon King
On Tue, Feb 26, 2013 at 2:44 PM, dalia dalia@gmail.com wrote: Hi, My intention is - to store .xls, .doc and .pdf files (with images in them) to store in a Oracle database and retrieve them. I'm using SQLAlchemy declarative code. The problem is, the data gets stored in the database but

Re: [sqlalchemy] Storing and Retrieving BLOB in SqlAlchemy

2013-02-27 Thread dalia
Thanks a lot Simon. I am using Pylons, but response.body actually worked. I can get my xls file alright now. Thanks for all your help! On Wednesday, February 27, 2013 11:40:22 AM UTC, Simon King wrote: On Tue, Feb 26, 2013 at 2:44 PM, dalia dali...@gmail.com javascript: wrote: Hi,

[sqlalchemy] Storing and Retrieving BLOB in SqlAlchemy

2013-02-26 Thread dalia
Hi, My intention is - to store .xls, .doc and .pdf files (with images in them) to store in a Oracle database and retrieve them. I'm using SQLAlchemy declarative code. The problem is, the data gets stored in the database but when I try to fetch the data back, it comes out as 0KB. I'm explaining

Re: [sqlalchemy] Storing and Retrieving BLOB in SqlAlchemy

2013-02-26 Thread Mauricio de Abreu Antunes
Well, I think you need to import BLOB from dialects like: from sqlalchemy.dialects.oracle import BLOB in your Model you can describe the field type following it: MyBLOBColumn = Column(BLOB) Actually, IMHO i don't think saving large contents (binary from binary files) as pure text in the

Re: [sqlalchemy] Storing and Retrieving BLOB in SqlAlchemy

2013-02-26 Thread dalia
Hi Mauricio, Thanks for the reply. But importing BLOB specifically did not solve the problem. It is the same. In the INSERT statement, it looks like it is storing the file in Binary, but then when I query the database, it just shows (BLOB) and not the data. My requirement is to store .xls,

Re: [sqlalchemy] Storing and Retrieving BLOB in SqlAlchemy

2013-02-26 Thread Mauricio de Abreu Antunes
Well, I would store the pshysical file in a system folder. After this I would save the path to the file in a table. Then you could manage your files via sqlalchemy, listing all files and working with them properly. 2013/2/26 dalia dalia@gmail.com Hi Mauricio, Thanks for the reply. But

Re: [sqlalchemy] Storing and Retrieving BLOB in SqlAlchemy

2013-02-26 Thread Werner
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

Re: [sqlalchemy] Storing and Retrieving BLOB in SqlAlchemy

2013-02-26 Thread Michael Bayer
On Feb 26, 2013, at 9:44 AM, dalia dalia@gmail.com wrote: Retrieving from database - now I want the file to be downloaded as an excel (.xls) file def _get_report(self): tbl = model.ReportFiles file = meta.Session.query(tbl).get(id=1) contentstr = file.report_file