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 largish PDF's) in PostgreSQL and
what I did was write an external C program that I let be called as a
CGI.  Although this approach seems slightly kludgy, it works well for a
few reasons:

1. Takes the load off your Python web framework (which tend to be not
good at serving large files).
2. Very high performance (will easily saturate 100Mbit if you let it). 3. Most importantly, psycopg (and hence everything that relies on it,
e.g. SQLAlchemy) doesn't currently support large objects, so it has to
be done some other way.


Basically I used this by wrapping it in a simple Python CGI (although
the ultimate goal was to make it directly callable from a CGI request
w/o any wrapper at all).  If you end up doing it this way, then you'll
want to figure out a way to prevent unauthorized users from accessing it
(either via HTTP AUTH or perhaps even by using one of the deep-link
preventing features of your webserver if it has them).

Hope this gives you a starting point.

Regards,
Cliff



tanks in advance ...

PS
sorry for my english ...


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Attachment: pgcatlo.tgz
Description: application/compressed-tar

Reply via email to