Re: {Spam} Need help with bash script and postgresql

From: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
To: pgsql-general(at)postgresql(dot)org, cpayne(at)magigames(dot)net
Subject: Re: {Spam} Need help with bash script and postgresql
Date: 2007-07-23 10:31:22
Message-ID: 200707231231.24081.dfontaine@hi-media.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Le lundi 23 juillet 2007, Chuck Payne a écrit :
> for i in `cat
> myfile.txt` ; do mysql -uxxx -pxxxx -Asse mydatabase  "insert
> into mytable  (aaa,bbb) values ("xxx",
> "yyy");"

It seems a part of your problem is not about scripting psql but loading data
into PostgreSQL, so let me present you with pgloader:
http://pgfoundry.org/projects/pgloader

It uses COPY to insert quickly some CSV (or CSV-like) formated data into the
database. You have to configure it (a section per input file, one input file
per table, see man page), then it will import the data. Then main difference
with plain COPY is that pgloader will be able to insert data in the presence
of bad input rows, simply discarding them, when COPY will cancel the load
entirely.

Hope this helps, regards,
--
dim

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Luca Ciciriello 2007-07-23 10:57:18 Re: Retrieve the record ID
Previous Message Andrus 2007-07-23 10:24:51 invalid memory alloc request size 2147483648 using toode LIKE 'ä%'