Re: bytea extraction

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Rich Harley <richard(at)scholarpack(dot)com>, psycopg(at)postgresql(dot)org
Subject: Re: bytea extraction
Date: 2014-02-03 17:54:45
Message-ID: 52EFD7E5.5070301@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: psycopg

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), 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?

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(dot)klaver(at)gmail(dot)com

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Rich Harley 2014-02-03 17:59:17 Re: bytea extraction
Previous Message Rich Harley 2014-02-03 17:50:19 bytea extraction