Fw: Problem with psycopg2, bytea, and memoryview

From: "Frank Millman" <frank(at)chagford(dot)com>
To: <psycopg(at)postgresql(dot)org>
Subject: Fw: Problem with psycopg2, bytea, and memoryview
Date: 2013-08-01 05:37:19
Message-ID: 25EDB20679154BDBB3CBBD335184E1D7@frank
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

Hi all

I recently posted about a problem I was having with psycopg2 returning a
'memoryview' for bytea objects. Daniele Varrazzo very kindly gave me an
effective workaround.

I had previously asked the question on the python mailing list. Among other
replies, I received the following comment. I felt that I should forward it
to this list, but I am passing it on for information only. I have no
personal opinion on the matter.

----- Original Message -----
From: "Terry Reedy" <tjreedy(at)udel(dot)edu>
Newsgroups: gmane.comp.python.general
To: <python-list(at)python(dot)org>
Sent: Wednesday, July 31, 2013 7:59 PM
Subject: Re: Problem with psycopg2, bytea, and memoryview

> On 7/31/2013 9:07 AM, Antoine Pitrou wrote:
>> Frank Millman <frank <at> chagford.com> writes:
>>>
>>> Thanks for that, Antoine. It is an improvement over tobytes(), but i am
>>> afraid it is still not ideal for my purposes.
>>
>> I would suggest asking the psycopg2 project why they made this choice,
>> and
>> if they would reconsider. Returning a memoryview doesn't make much sense
>> IMHO.
>
> I agree.
> "memoryview objects allow Python code to access the internal data of an
> object that supports the buffer protocol without copying."
> Example: the binary image data of an image object.
> They are not intended to be a standalone objects when there is an obvious
> alternative (in this case, bytes).
>
> --
> Terry Jan Reedy
>

Thanks

Frank Millman

Responses

Browse psycopg by date

  From Date Subject
Next Message Frank Millman 2013-08-01 08:13:03 Re: Problem with memoryview
Previous Message Daniele Varrazzo 2013-07-31 14:56:26 Re: Problem with memoryview