[sqlalchemy] Re: Postgre e pg_largeobject

2007-01-18 Thread Antonio
* mercoledì 17 gennaio 2007, alle 09:30, Michael Bayer wrote : print Content-type:text/pdf\n\n# whatever the header is for pdf for chunk in res.pdf: sys.stdout.write(chunk.data) I would agree that the approach taken by pg_largeobject is a useful approach in that you can read just

[sqlalchemy] Re: Postgre e pg_largeobject

2007-01-17 Thread Jonathan Ellis
On 1/17/07, Antonio [EMAIL PROTECTED] wrote: and now, how can I retrieve the file (res.pdf.data) in a file or send it as output in a html page (sendig the right headers) ? Nothing magical: file('foo.pdf', 'wb').write(res.pdf.data) see your html framework's docs for instructions on sending

[sqlalchemy] Re: Postgre e pg_largeobject

2007-01-17 Thread Jonathan Ellis
Oops, I didn't notice at first that you are using pg_largeobject... That's not a good idea, you should really use bytea (for SA, that means declaring filepdf as a Binary column itself rather than linking to pg_largeobject) unless you are planning to manually seek inside the lo (i.e. with

[sqlalchemy] Re: Postgre e pg_largeobject

2007-01-17 Thread Cliff Wells
On Wed, 2007-01-17 at 11:45 +0100, Antonio wrote: Hi all, I'm trying to read a pdf file saved in a postgresql table : and now, how can I retrieve the file (res.pdf.data) in a file or send it as output in a html page (sendig the right headers) ? Antonio, I did a very similar thing (storing