Re: [GENERAL] Load multiple CSV file in Postgres using COPY - Mailing list pgsql-general

From Murtuza Zabuawala
Subject Re: [GENERAL] Load multiple CSV file in Postgres using COPY
Date
Msg-id CAKKotZTEbDeEXp1kuw7W9fu7h1JkboSk8qMZobdrxdfAFdmK-A@mail.gmail.com
Whole thread Raw
In response to Re: [GENERAL] Load multiple CSV file in Postgres using COPY  (Alexander Shchapov <alexanderad@gmail.com>)
Responses Re: [GENERAL] Load multiple CSV file in Postgres using COPY  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
Thank you All for your suggestions, But I was looking for solution around COPY command only.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


On Fri, Feb 17, 2017 at 3:06 PM, Alexander Shchapov <alexanderad@gmail.com> wrote:
You might want to look into pgloader: http://pgloader.io/

On Fri, Feb 17, 2017 at 7:26 AM, Murtuza Zabuawala
<murtuza.zabuawala@enterprisedb.com> wrote:
> Hi,
>
> Is there any way to load multiple CSV files at once using single COPY
> command?
>
> I have scenario where I have to load multiple files,
>
> COPY prdxgdat FROM 'Z:/data-2016-04-01.csv' WITH DELIMITER ',' CSV HEADER Y
> COPY prdxgdat FROM 'Z:/data-2016-04-02.csv' WITH DELIMITER ',' CSV HEADER Y
> COPY prdxgdat FROM 'Z:/data-2016-04-03.csv' WITH DELIMITER ',' CSV HEADER Y
> COPY prdxgdat FROM 'Z:/data-2016-04-04.csv' WITH DELIMITER ',' CSV HEADER Y
> COPY prdxgdat FROM 'Z:/data-2016-04-05.csv' WITH DELIMITER ',' CSV HEADER Y
> COPY prdxgdat FROM 'Z:/data-2016-04-06.csv' WITH DELIMITER ',' CSV HEADER Y
> ..
> ..
> ..
> ..
> COPY prdxgdat FROM 'Z:/data-2016-04-50.csv' WITH DELIMITER ',' CSV HEADER Y
>
> 50 files -> 50 COPY command, In my use case I think this is not a good way
> to load data, Can you suggest any better way to do this?
>
> I can always write external script (eg: shell script) but is there any other
> way to do this using single COPY command?
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company



--
Alexander Shchapov

pgsql-general by date:

Previous
From: Jean-Michel Scheiwiler
Date:
Subject: [GENERAL] Access privileges /yyyy -- role that granted this privilege.
Next
From: Adrian Klaver
Date:
Subject: Re: [GENERAL] Load multiple CSV file in Postgres using COPY