Skip site navigation (1) Skip section navigation (2)

Re: Postgresql Copy

From: Andrew Gould <andrewgould(at)yahoo(dot)com>
To: "samsom, debra" <dsamsom(at)bristol(dot)ca>, pgsql-general(at)postgresql(dot)org
Subject: Re: Postgresql Copy
Date: 2001-10-31 22:25:16
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
I think that is correct.  If I'm wrong, I'm sure I'll
be corrected.

I import fixed width data using one of two methods:

1.  I import the data into MS Access, which can deal
with fixed width data; and then I move the data to
PostgreSQL via ODBC connection.

2.  There's a huge fixed width file that I receive
every quarter.  Since the structure is the same, I
wrote a python script that copies the data to a new
file, inserting tab delimiters and stripping out the
extra spaces as it goes.  The resulting file is often
one third the size of the original.  I then use copy
to import the tab delimited data into PostgreSQL.

If you'd like me to send the python script, let me
know.  Basically, you'll have to adjust the file to
fit your data table's definition.  (Or send me the
definition of one table and I'll adjust it this once.)
 In any case, the original file is left unchanged
should anything go wrong.

Best of luck,

Andrew Gould

--- "samsom, debra" <dsamsom(at)bristol(dot)ca> wrote:
> Is there away to copy fixed length text files into
> an Postgresql table.
> After reading the doc's it looks Postgresql expects
> some sort of delimiter.

Do You Yahoo!?
Make a great connection at Yahoo! Personals.

In response to


pgsql-general by date

Next:From: Lamar OwenDate: 2001-10-31 22:35:53
Subject: Re: fresh install of postgres 7.1 doesn't start postmaster with the "-i" flag
Previous:From: John fabianiDate: 2001-10-31 21:54:37
Subject: how to get compound indexes

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group