From: | Tobias Oberstein <tobias(dot)oberstein(at)gmail(dot)com> |
---|---|
To: | Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com> |
Cc: | Ronan Dunklau <rdunklau(at)gmail(dot)com>, psycopg(at)postgresql(dot)org |
Subject: | Re: flexi adaption/casting scheme |
Date: | 2012-09-22 13:44:02 |
Message-ID: | 505DC0A2.9000802@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
Am 22.09.2012 15:30, schrieb Daniele Varrazzo:
> On Sat, Sep 22, 2012 at 2:25 PM, Tobias Oberstein
> <tobias(dot)oberstein(at)gmail(dot)com> wrote:
>
>> the _from_db class method on CompositeCaster takes a name argument and
>> parsed that into "schema" and "typename".
>>
>> It uses both to retrieve Oids etc, but then only forwards "typename", and
>> not "schema" to the CompositeCaster constructor.
>>
>> If a have 2 composite types defined "public.t_foo" and "bar.t_foo", and
>> register both, one will be overwritten ..
>
> Uhm... why overwritten? The two CompositeCaster will register two
> different typecasters on two different oids. The name is only used as
Ok. So new_type/new_array_type have no issue with having the same "name"
used twice on different OIDs?
> name namedtuple name. What would the schema be used for?
My use case: have a CompositeDictCaster that spits out:
{'record': 'public.t_station', 'x': 10, 'y': 8}
that is injects a 'record' field containing the composite type name.
Hence I need the schema, not only the typename.
Background:
I am experimenting with that in combination with a custom dict adapter
that is able to adapt such value again into
(10, 8, NULL)::public.t_station
so this is fully "round trippable". That way the type info is embedded
and I don't need to do complex object mangling.
The motivation for all this: I have a network server that has a
JSON/WebSocket based API for RPC (and PubSub), and I want to forward
those to PostgreSQL stored procedure calls.
Call PG stored procs from browser JS ..
Cheers,
Tobias
>
> -- Daniele
>
From | Date | Subject | |
---|---|---|---|
Next Message | Daniele Varrazzo | 2012-09-22 13:53:20 | Re: flexi adaption/casting scheme |
Previous Message | Daniele Varrazzo | 2012-09-22 13:30:22 | Re: flexi adaption/casting scheme |