Re: Populating a database

Поиск
Список
Период
Сортировка
От Nick Sayer
Тема Re: Populating a database
Дата
Msg-id 3DC6B63E.3000602@kfu.com
обсуждение исходный текст
Ответ на Populating a database  (papapep <papapep@gmx.net>)
Список 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 по дате отправления:

Предыдущее
От: "Henshall, Stuart - Design & Print"
Дата:
Сообщение: Re: moving a postgreSQL DB, etc.
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Populating a database