Re: {Spam} Need help with bash script and postgresql - Mailing list pgsql-general

From Dimitri Fontaine
Subject Re: {Spam} Need help with bash script and postgresql
Date
Msg-id 200707231231.24081.dfontaine@hi-media.com
Whole thread Raw
In response to Need help with bash script and postgresql  ("Chuck Payne" <cpayne@magigames.net>)
List 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

Attachment

pgsql-general by date:

Previous
From: Raymond O'Donnell
Date:
Subject: Re: Need help with bash script and postgresql
Next
From: "Luca Ciciriello"
Date:
Subject: Re: Retrieve the record ID