Reading binary data from Postgres 9

Поиск
Список
Период
Сортировка
От Ian
Тема Reading binary data from Postgres 9
Дата
Msg-id 1313713708.22500.YahooMailNeo@web39415.mail.mud.yahoo.com
обсуждение исходный текст
Ответы Re: Reading binary data from Postgres 9
Список psycopg
Hi list,

I am storing a NumPy array in binary form in Postgres with:

import numpy as np
...
my_array = np.array(data_list, np.float32)
cur.execute("insert into my_table values (%s)", (psycopg2.Binary(my_array),))

I've confirmed that this works fine. However when I query this binary data from the database I am having trouble deserializing/getting it back into a NumPy array. The result comes back as a read-only buffer. Does psycopg2 have an opposite of Binary to handle this?

Thanks.

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

Предыдущее
От: Federico Di Gregorio
Дата:
Сообщение: Re: Vacancy!
Следующее
От: Daniele Varrazzo
Дата:
Сообщение: Re: Reading binary data from Postgres 9