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 lo_lseek, etc.), and it doesn't look like you are. I don't believe SA really supports using pg_largeobject, they're kind of obsoleted by bytea. On 1/17/07, Antonio <[EMAIL PROTECTED]> wrote:
Hi all, I'm trying to read a pdf file saved in a postgresql table : pdf_tbl=sqa.Table('pg_largeobject', _mdata, sqa.Column('loid', sqa.Integer, primary_key = True), sqa.Column('pageno', sqa.Integer), sqa.Column('data', sqa.Binary) ) sqa.mapper(Pdf,pdf_tbl) sqa.mapper(Pdf,pdf_tbl) fax_tbl=sqa.Table('faxes', _mdata, sqa.Column('id', sqa.Integer, primary_key = True), sqa.Column('sender', sqa.TEXT), sqa.Column('pages', sqa.SmallInteger), sqa.Column('received', sqa.DateTime), sqa.Column('filepdf', sqa.Integer, sqa.ForeignKey('pg_largeobject.loid')) ) sqa.mapper(Fax,fax_tbl,properties={ 'pdf': sqa.relation(Pdf) }) sess=sqa.create_session() qry=sess.query(Fax) res=qry.get_by(id=1) 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) ? tanks in advance ... PS sorry for my english ... -- #include <stdio.h> int main(void){char c[]={10,65,110,116,111,110,105,111,32,98,97,114,98,111,110, 101,32,60,104,105,110,100,101,109,105,116,64,116,105,115,99,97,108,105,110,101, 116,46,105,116,62,10,10,0};printf("%s",c);return 0;} >
--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---