On Fri, Jul 1, 2011 at 2:05 PM, Ronan Dunklau <ronan(dot)dunklau(at)kozea(dot)fr> wrote:
> I'd like to register a type converter for _record (array of records).
> What is the "recommended" way to implement such a type ?
Psycopg doesn't play well with the generic record, as it has no type
information to parse the components. It can map user-defined types
though, as these informations are available in the catalog. However
there's currently no support for arrays of composite.
> I've seen that a "GENERIC_ARRAY" type caster is available in the c library,
> but I don't know how to access it from python.
I don't know the code in typecast_array.c very well, but if it can
tokenize the array string representation and delegate parsing of the
single items to another typecaster it should be easy to create the
missing array casters (composite array, hstore array...).
I think the code for the generic array casting is currently not
exposed to python. Probably a good extension could be to add an
optional array_oids parameter to the new_type() function in order to
register the arrays together with the base type
In response to
psycopg by date
|Next:||From: deavid||Date: 2011-07-05 07:07:47|
|Subject: Named Cursors WITH HOLD|
|Previous:||From: Ronan Dunklau||Date: 2011-07-01 13:05:44|
|Subject: Custom array types converter|