Re: Load data from a csv file without using COPY

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Load data from a csv file without using COPY
Дата
Msg-id CAKFQuwYhfbUqbevbgv=nT2HmOeeAcncUwZ=YWdyF8Y3+Nz9f_w@mail.gmail.com
обсуждение исходный текст
Ответ на Load data from a csv file without using COPY  (Ravi Krishna <srkrishna@yahoo.com>)
Список pgsql-general
On Tue, Jun 19, 2018 at 1:16 PM, Ravi Krishna <srkrishna@yahoo.com> wrote:
In order to test a real life scenario (and use it for benchmarking) I want to load large number of data from csv files. 
The requirement is that the load should happen like an application writing to the database ( that is, no COPY command).
Is there a tool which can do the job.  Basically parse the csv file and insert it to the database row by row.

​I'm skeptical that injesting CSV of any form, even if you intentionally blow things up by converting into:

BEGIN;
INSERT INTO tbl VALUES ('','','');
COMMIT;
BEGIN;
INSERT INTO tbl VALUES ('','','');
COMMIT;

(which is what auto-commit mode looks like)

Is going to provide a meaningful ​benchmark for application-like usage patterns.

But anyway, I'm not familiar with any tools that make doing this particularly simple.  In most situations like this I'll just import the CSV into a spreadsheet and create a formula that builds out the individual SQL commands.  Whether that's useful depends a lot on how often the source CSV is updated.

That said, I have the following tool to be generally helpful in this area - though I'm thinking it doesn't do what you want here.


David J.

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

Предыдущее
От: Hans Schou
Дата:
Сообщение: Re: Load data from a csv file without using COPY
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: Is postorder tree traversal possible with recursive CTE's?