Re: Data conversion question - Mailing list pgsql-general

From Doug McNaught
Subject Re: Data conversion question
Date
Msg-id m3snikfs87.fsf@belphigor.mcnaught.org
Whole thread Raw
In response to Data conversion question  (Bill <justbill@ameritech.net>)
List pgsql-general
Bill <justbill@ameritech.net> writes:

> I have some data in dBase III compatible files (created with Alpha
> Four, v4) that I want to move to Postgresql. I have already read the
> Admin pages of the manual and didn't see anything that would point
> the way.
>
> Does anyone else have any suggestions? Would it help if I exported
> the files to some other format ... perhaps CSV? Alpha Four offers
> several common (but older) file formats for export.

You have a couple options.

There is a Perl module (called DBD::XBase IIRC) that lets you treat
dBase-ish files as a (limited) SQL database.  So you could write a
Perl script that reads from your dBase files and inserts into your PG
database.

Or you could see if it's possible to export from Alpha Four in a
format that the PostgreSQL "COPY" command can deal with--basically,
one record per line, no quotes, with fields delimited by a character
("|", say) that doesn't appear in the data.  If you can do this, you
can use COPY to import the data and it will be fast and convenient.

> I read a post earlier where someone was advised to read the FAQ but
> I'm new to the neighborhood and don't know where to find them.

http://postgresql.readysetnet.com/docs/faq-english.html

> If the conversion is not going to be fairly straightforward using
> just pgsql, could someone point me to a conversion script or program
> somewhere?
>
> I don't want to become a pgsql guru ... I just want to read and edit
> THIS data and continue to add to these tables.

Hope my ramblings above are helpful...

-Doug
--
The rain man gave me two cures; he said jump right in,
The first was Texas medicine--the second was just railroad gin,
And like a fool I mixed them, and it strangled up my mind,
Now people just get uglier, and I got no sense of time...          --Dylan

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: subtratcing dates
Next
From: Ashley Clark
Date:
Subject: Re: VACUUM is hanging