[psycopg] Parse record type into tuple

Поиск
Список
Период
Сортировка
От Dmytro Starosud
Тема [psycopg] Parse record type into tuple
Дата
Msg-id CANC2W+A88-8b9VzEkTh1cma9ezTtvNa7Z6gK6_LL1e7udZLjFA@mail.gmail.com
обсуждение исходный текст
Ответы Re: [psycopg] Parse record type into tuple  (Rory Campbell-Lange <rory@campbell-lange.net>)
Re: [psycopg] Parse record type into tuple  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Список psycopg
Hello guys

I do following interactions with DB:

In [48]: conn = psycopg2.connect("dbname=... user=... password=...")
In [49]: cur = conn.cursor()
In [50]: cur.execute("select (1, 2)")
In [51]: cur.fetchone()
Out[51]: ('(1,2)',)

Is it possible to get that tuple parsed into python tuple in the same way array works?

In [55]: cur.execute("select array[1, 2]")
In [56]: cur.fetchone()
Out[56]: ([1, 2],)

Looks like that can be done if I register composite type for that tuple.
But I would like it to work with any tuple.

Please assist.

Thanks in advance!
Dmytro 

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

Предыдущее
От: Daniele Varrazzo
Дата:
Сообщение: [psycopg] Psycopg 2.7.3.1 released
Следующее
От: Rory Campbell-Lange
Дата:
Сообщение: Re: [psycopg] Parse record type into tuple