From: | Pierre-Frédéric Caillaud <lists(at)boutiquenumerique(dot)com> |
---|---|
To: | CSN <cool_screen_name90001(at)yahoo(dot)com>, pgsql-general(at)postgresql(dot)org, "pgsql hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: copy - fields enclosed by, ignore x lines |
Date: | 2004-10-25 22:55:38 |
Message-ID: | opsgf7a0amcq72hf@musicbox |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Use python's (or another language) CSV reader module which will parse the
quotes for you and write the values in a tab-delimited file. Don't forget
to escape the tabs in the strings... it should be less than 10 lines of
code.
On Mon, 25 Oct 2004 14:45:57 -0700 (PDT), CSN
<cool_screen_name90001(at)yahoo(dot)com> wrote:
> Any chance of changing \copy and COPY to allow
> specifying what the fields are enclosed by (such as
> quotes) and to ignore the first x number of lines? I
> have data like below and don't know of an easy way to
> finesse it for importing (a simple regexp would remove
> quotes, but I just got tripped up on commas *within*
> values).
>
> "field1","field2","field3"
> "val1","val2","val3"
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We finish.
> http://promotions.yahoo.com/new_mail
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
From | Date | Subject | |
---|---|---|---|
Next Message | Uwe C. Schroeder | 2004-10-25 23:10:44 | Re: newbie |
Previous Message | Rick | 2004-10-25 22:48:54 | newbie |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-10-25 23:11:05 | Re: [PATCHES] ARC Memory Usage analysis |
Previous Message | Kenneth Marshall | 2004-10-25 22:48:30 | Re: [PATCHES] ARC Memory Usage analysis |