From: | Rory Campbell-Lange <rory(at)campbell-lange(dot)net> |
---|---|
To: | psycopg(at)postgresql(dot)org |
Subject: | generic new_array_type type caster |
Date: | 2012-10-31 17:02:38 |
Message-ID: | 20121031170238.GA28429@campbell-lange.net |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
I'd like to make a generic 'to array' type caster for any types not
natively recognised by psycopg2. Specifically, not only do I want to
convert types such as json and uuid, but it would be useful to have
varchar arrays for any unrecognised types (I appreciate uuids are now a
recognised type since 2.0.9).
I've looked at
http://initd.org/psycopg/docs/extensions.html#psycopg2.extensions.new_array_type
and the following code:
psycopg2.extensions.register_type(
psycopg2.extensions.new_array_type(
(1040,), 'MACADDR[]', psycopg2.STRING))
I'm worried about the following:
- avoiding providing oids of all types we don't know about, since it might be
different in every database we connect to
- how to learn the oids of array types already handled by psycopg2
Rory
--
Rory Campbell-Lange
rory(at)campbell-lange(dot)net
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Tiffin | 2012-11-20 20:33:18 | Trying to understand why same SQL returns different results. |
Previous Message | yuyan zhang | 2012-10-26 04:07:29 | hi |