bytea extraction

From: Rich Harley <richard(at)scholarpack(dot)com>
To: psycopg(at)postgresql(dot)org
Subject: bytea extraction
Date: 2014-02-03 17:50:19
Message-ID: 9D8BA8C6-5531-483F-943C-1B2649CA61C1@scholarpack.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: psycopg

How do I grab a bytea object stored in a postgres database and write it to the filesystem?

Say I have a .jpeg stored in a table called pictures. I want to extra that object (select picture from pictures), then write it to a file called picture.jpg through the use of a python script.
I have tried several ways but the end file is always messed up and not the original picture.
Any pointers?

Thanks
Rich

On 8 Jan 2014, at 13:20, psycopg-owner(at)postgresql(dot)org wrote:

> Message Digest
> Volume 1 : Issue 248 : "index" Format
>
> Messages in this Issue:
> 201401/2 : Psycopg 2.5.2 released

Responses

Browse psycopg by date

  From Date Subject
Next Message Adrian Klaver 2014-02-03 17:54:45 Re: bytea extraction
Previous Message Daniele Varrazzo 2014-01-07 12:54:16 Psycopg 2.5.2 released