Re: Newbie question about importing text files...

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Newbie question about importing text files...
Date: 2006-10-10 09:16:48
Message-ID: 452B6500.2040703@cox.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/09/06 22:43, Jonathan Greenberg wrote:
> So I've been looking at the documentation for COPY, and I'm curious about a
> number of features which do not appear to be included, and whether these
> functions are found someplace else:
>
> 1) How do I skip an arbitrary # of "header" lines (e.g. > 1 header line) to
> begin reading in data?
> 2) Is it possible to screen out lines which begin with a comment character
> (common outputs for csv/txt files from various programs)?
> 3) Is there a way to read in fixed width files?

Both Python & Perl have CSV parsing modules, and can of course deal
with fixed-width data, let you skip comments, commit every N rows,
skip over committed records in can the load crashes, etc, etc, etc.

Probably not what you wanted to read, though, since performance
takes a big hit. But it definitely works...

- --
Ron Johnson, Jr.
Jefferson LA USA

Is "common sense" really valid?
For example, it is "common sense" to white-power racists that
whites are superior to blacks, and that those with brown skins
are mud people.
However, that "common sense" is obviously wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFK2UAS9HxQb37XmcRAmOqAJ4um4xLJnKBVQ2LWB1kYYIJyBNHZgCgv/gk
griA2wHFOEogj2WToM5mxpc=
=gn/u
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ludwig Kniprath 2006-10-10 09:30:10 Problem compiling PostGIS 1.1.4
Previous Message Ron Johnson 2006-10-10 09:03:02 Re: Newbie question about importing text files...