generic new_array_type type caster

Поиск
Список
Период
Сортировка
От Rory Campbell-Lange
Тема generic new_array_type type caster
Дата
Msg-id 20121031170238.GA28429@campbell-lange.net
обсуждение исходный текст
Список 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@campbell-lange.net


В списке psycopg по дате отправления:

Предыдущее
От: yuyan zhang
Дата:
Сообщение: hi
Следующее
От: Neil Tiffin
Дата:
Сообщение: Trying to understand why same SQL returns different results.