Re: [GENERAL] import CSV file to a table

Поиск
Список
Период
Сортировка
От Vick Khera
Тема Re: [GENERAL] import CSV file to a table
Дата
Msg-id CALd+dcfmwycYbggHJAyrA3a0RLeVRmntywivGAXU8pfK1oPBUw@mail.gmail.com
обсуждение исходный текст
Ответ на [GENERAL] import CSV file to a table  (Günce Kaya <guncekaya14@gmail.com>)
Список pgsql-general
Since you're using bash, I will assume you are not averse to using a slightly complicated pipeline. First, install this: https://github.com/wireservice/csvkit

Then use that to cut out the columns, you want and pipe the result into psql with an appropriate \copy command.

On Wed, Mar 8, 2017 at 4:13 AM, Günce Kaya <guncekaya14@gmail.com> wrote:
Hi all,

I want to import content of CSV file to a table via bash script without creating temporary table and I also want to skip some columns in CSV file (for instance, CSV file has 12 column and main table has only 2 column, If possible I would use only 2 column in CSV file) Is there any way to do it? 

Regards,

--
Gunce Kaya

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

Предыдущее
От: Yogesh Sharma
Дата:
Сообщение: Re: [GENERAL] Request to confirm which command is use for exclusive operation
Следующее
От: John McKown
Дата:
Сообщение: Re: [GENERAL] import CSV file to a table