Re: flexi adaption/casting scheme

From: Ronan Dunklau <rdunklau(at)gmail(dot)com>
To: psycopg(at)postgresql(dot)org
Cc: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>, Tobias Oberstein <tobias(dot)oberstein(at)gmail(dot)com>
Subject: Re: flexi adaption/casting scheme
Date: 2012-09-21 13:47:48
Message-ID: 1896027.IKvkcEHX0B@ropc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

> 1.3
> composite type => plain Python dict with key/value pairs only
> for all attributes in the composite type that have non-NULL values

It would be great to have an API to customize the class to instantiate with a
composite type.

I tried an implementation in the attached patch.

The idea would be to add an optional "ctor" argument, which would be used in
place of the namedtuple argument. Additionally, an adapter can be
automatically registered to perform the reverse conversion.

Regards,

--
Ronan Dunklau

Attachment Content-Type Size
customizable_composite.patch text/x-patch 7.0 KB

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Tobias Oberstein 2012-09-21 14:14:54 Re: flexi adaption/casting scheme
Previous Message Daniele Varrazzo 2012-09-21 00:38:30 Re: flexi adaption/casting scheme