Обсуждение: Storing file in postgresql and accessing them with psycopg

Поиск
Список
Период
Сортировка

Storing file in postgresql and accessing them with psycopg

От
Ottavio Campana
Дата:
Hi,

for a project, I'll need to store files in the database, because I won't be
able to write to the disk of the application.

I've been looking online about how to do it, and I've seen that there are
two ways, i.e. with bytea and oid. Particularly I found this page
http://www.zephid.dk/2008/08/09/oid-vs-bytea-in-postgresql/ , it's about
php but it can give a few hints, even though it's more than three years
old.

So, my questions are:

* do you have experience with newer version of postgresql (9.x)? Is there
something particular I need to consider?

* I've read http://packages.python.org/psycopg2/extensions.html , thus I
still think oid is the way to go, but I haven't been able to find an
example to use as reference. Can you please suggest me something?

Thank you

Ottavio

--
Non c'e' piu' forza nella normalita', c'e' solo monotonia

Re: Storing file in postgresql and accessing them with psycopg

От
Federico Di Gregorio
Дата:
On 05/01/12 11:29, Ottavio Campana wrote:
> I've been looking online about how to do it, and I've seen that there are
> two ways, i.e. with bytea and oid. Particularly I found this page
> http://www.zephid.dk/2008/08/09/oid-vs-bytea-in-postgresql/  , it's about
> php but it can give a few hints, even though it's more than three years
> old.

I'd like to see such a test done in Python using psycopg. From the text
one doesn't understand if the overhead is due to PostgreSQL or the PHP
driver. LOBs are nice because they have file-like semantics so probably
have a less overhead for large files but I don't see why small files
should have such an high impact on bytea.

federico