Re: bytea extraction - Mailing list psycopg

From Rich Harley
Subject Re: bytea extraction
Date
Msg-id CFF4343A-8298-44D9-8CFA-0E5F7DDA477D@scholarpack.com
Whole thread Raw
In response to Re: bytea extraction  (Adrian Klaver <adrian.klaver@gmail.com>)
Responses Re: bytea extraction  (Adrian Klaver <adrian.klaver@gmail.com>)
List psycopg
Ah, I see. It’s postgres 9.1 and psycopg1 (through Zope 2.11) - an old one but we have found no need to upgrade as yet
becausewe only use very simple data types. 

When the data goes in it goes through psycopg.Binary(photo).
So it’s really the reverse of that I need.


On 3 Feb 2014, at 17:54, Adrian Klaver <adrian.klaver@gmail.com> wrote:

> On 02/03/2014 09:50 AM, Rich Harley wrote:
>> 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),
thenwrite 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?
>
> Well the default format for bytea has changed with Postgres versions and how Psycopg handles same has changed over
time.So to begin to answer this we will need to know what versions of Postgres and psycopg2 you are using? 
>
>>
>> Thanks
>> Rich
>>
>
>
>
> --
> Adrian Klaver
> adrian.klaver@gmail.com



psycopg by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: bytea extraction
Next
From: Adrian Klaver
Date:
Subject: Re: bytea extraction