Re: [GENERAL] import CSV file to a table - Mailing list pgsql-general

From Vick Khera
Subject Re: [GENERAL] import CSV file to a table
Date
Msg-id CALd+dcfmwycYbggHJAyrA3a0RLeVRmntywivGAXU8pfK1oPBUw@mail.gmail.com
Whole thread Raw
In response to [GENERAL] import CSV file to a table  (Günce Kaya <guncekaya14@gmail.com>)
List 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 by date:

Previous
From: Yogesh Sharma
Date:
Subject: Re: [GENERAL] Request to confirm which command is use for exclusive operation
Next
From: John McKown
Date:
Subject: Re: [GENERAL] import CSV file to a table