Re: Populating a database - Mailing list pgsql-novice

From Nick Sayer
Subject Re: Populating a database
Date
Msg-id 3DC6B63E.3000602@kfu.com
Whole thread Raw
In response to Populating a database  (papapep <papapep@gmx.net>)
List pgsql-novice
papapep wrote:

> How can I populate a database with data I've got in a spreadsheet
> without having to format it with all the terrible format with commas,
> sql orders and so on??
> Or, at least, which is the easiest way to do it?

Probably the easiest way, if you're good with perl, is to save the
spreadsheet in a suitably helpful ASCII format (CSV or what not), then
write a custom perl script that uses the Pg module to import the data.

Alternatively, you could use perl (or anything else) to change the ASCII
format into a big COPY statement and use \i in psql to import it.

Last, but not least, if you've got Windows, you could use ODBC with an
ODBC->postgres driver, though the details escape me (and the perl option
is probably easier).

>
>
> Thanks in advance for your answer.
>
> Josep Sànchez
>  [papapep]
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster




pgsql-novice by date:

Previous
From: "Henshall, Stuart - Design & Print"
Date:
Subject: Re: moving a postgreSQL DB, etc.
Next
From: Josh Berkus
Date:
Subject: Re: Populating a database