Re: Using COPY to import large xml file

From: Nicolas Paris <niparisco(at)gmail(dot)com>
To: Anto Aravinth <anto(dot)aravinth(dot)cse(at)gmail(dot)com>
Cc: Tim Cross <theophilusx(at)gmail(dot)com>, Adrien Nayrat <adrien(dot)nayrat(at)anayrat(dot)info>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Using COPY to import large xml file
Date: 2018-06-25 14:50:16
Message-ID: CA+ssMOQkESnR2r5b-5L819Rf9KJ95--dTaX1wTPXtyWqUqkpug@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2018-06-25 16:25 GMT+02:00 Anto Aravinth <anto(dot)aravinth(dot)cse(at)gmail(dot)com>:

> Thanks a lot. But I do got lot of challenges! Looks like SO data contains
> lot of tabs within itself.. So tabs delimiter didn't work for me. I thought
> I can give a special demiliter but looks like Postrgesql copy allow only
> one character as delimiter :(
>
> Sad, I guess only way is to insert or do a through serialization of my
> data into something that COPY can understand.
>

​easiest way would be:
xml -> csv -> \copy

​by csv, I mean regular quoted csv (Simply wrap csv field with double
quote, and escape
enventually contained quotes with an other double quote.).

Postgresql copy csv parser is one of the most robust I ever tested
before.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Anto Aravinth 2018-06-25 15:24:28 Re: Using COPY to import large xml file
Previous Message Anto Aravinth 2018-06-25 14:25:25 Re: Using COPY to import large xml file