From: | Andrew Taylor <andydtaylor(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Importing 120 csv files bulk multiple |
Date: | 2013-02-12 15:14:03 |
Message-ID: | CAFAE3Jzz2-3rpUh9DLpgFdkjmoxvyCNMZ5mhy9eExdic35nCVA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
As per title I need to import a load of csv files. So I wrote a bash script
to generate the statements I needed (attached). However, this is failing on
my ubuntu laptop - it seems to occasionally miss the semicolon to execute.
What I did was copy the text to clipboard and paste it in to bash. Is there
maybe a way to open this file and evaluate it within psql? Output shown
below:
COPY 11340
postgres=# copy postcode_input from
'/home/andyt/projects/django-stringer/Other/codepo_gb/Data/ub.csv' using
delimiters ','
postgres-# copy postcode_input from
'/home/andyt/projects/django-stringer/Other/codepo_gb/Data/wa.csv' using
delimiters ',';
ERROR: syntax error at or near "copy"
LINE 2: copy postcode_input from '/home/andyt/projects/django-string...
^
postgres=#
postgres=# copy postcode_input from
'/home/andyt/projects/django-stringer/Other/codepo_gb/Data/w.csv' using
delimiters ',';
COPY 19787
postgres=#
postgres=# copy postcode_input from
'/home/andyt/projects/django-stringer/Other/codepo_gb/Data/wf.csv' using
delimiters ','
postgres-# copy postcode_input from
'/home/andyt/projects/django-stringer/Other/codepo_gb/Data/wn.csv' using
delimiters ',';
ERROR: syntax error at or near "copy"
LINE 2: copy postcode_input from '/home/andyt/projects/django-string...
^
postgres=# copy postcode_input from
'/home/andyt/projects/django-stringer/Other/codepo_gb/Data/wr.csv' using
delimiters ',';
COPY 8381
postgres=# copy postcode_input from
'/home/andyt/projects/django-stringer/Other/codepo_gb/Data/ws.csv' using
delimiters ',';
COPY 9884
postgres=# copy postcode_input from
'/home/andyt/projects/django-stringer/Other/codepo_gb/Data/wv.csv' using
delimiters ',';
COPY 9440
Thanks,
Andy
Attachment | Content-Type | Size |
---|---|---|
poscodeInput.txt | text/plain | 13.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Ryan Kelly | 2013-02-12 15:29:37 | Re: Importing 120 csv files bulk multiple |
Previous Message | Carlo Stonebanks | 2013-02-12 14:33:43 | Re: Tcl & PG on Win 7 64 bit - is it working for anyone? |