Re: Does PLPythonU support COPY table FROM string?

Поиск
Список
Период
Сортировка
От Dominik Czarnota
Тема Re: Does PLPythonU support COPY table FROM string?
Дата
Msg-id CABEVAa2F5f6Cn7bBku_jJV3uSZ7ovYahj_ZPZrLuNhjLHidXDg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Does PLPythonU support COPY table FROM string?  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
Unless I miss something, cursor won't help here - it is to retrieve data, not to insert it.

I just need a missing feature of `plpy` to do COPY (actually doable, but from file).

Anyway, after normalizing my tables and removing constraints and indexes for the time of data loading, the current solution (COPY FROM file that is saved a moment before...) is enough.
Although, if there is any place I can post to make a "feature request" to add methods that would do postgres COPY in plpy, I would be thankful for pointing me that place.

2015-08-29 1:34 GMT+02:00 Adrian Klaver <adrian.klaver@aklaver.com>:
On 08/28/2015 10:12 AM, Dominik Czarnota wrote:
Oh... I have copied stacktrace generated from Python script which
connects to the db using psycopg2 driver, so that's where this
misleading psycopg2 error came from...

About the list origin - I have to calculate a lot of stuff for each
stock on stock exchange market. Each calculation requires quotes from
the database - so to reduce io and not to fetch them everytime from
Python, I've created a plpythonu function that calculates everything for
each stock.
As the results also have to stay in the database, I need to use the
fastest possible method to insert a lot of data.

This means moving the results to another table?

Have you looked at plpy.cursor here:

http://www.postgresql.org/docs/9.4/interactive/plpython-database.html


Another problem for those calculations would be parallelizing them
somehow (I hope postgres clustering will do the work), but that's
totally unrelated to the problem we are discussing now.




--
Adrian Klaver
adrian.klaver@aklaver.com

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

Предыдущее
От: Ray Stell
Дата:
Сообщение: bdr admin role
Следующее
От: Melvin Davidson
Дата:
Сообщение: Re: bdr admin role