Re: Importing complete txt file with column names - Mailing list pgsql-novice

From Josh Jore
Subject Re: Importing complete txt file with column names
Date
Msg-id Pine.BSO.4.44.0207030744500.30576-100000@kitten.greentechnologist.org
Whole thread Raw
In response to Importing complete txt file with column names  (robert kraus <rob_kra@yahoo.com>)
List pgsql-novice
This is where you grab your trusty language of choice (scripting most
likely) and write a one-off to take input like:

attr\tattr0\tattr1....
0\t1\t2\t.....

and turn it into

CREATE TABLE ... (
    attr ....?,
    attr0 ....?,
    attr1 ....?
    .....
);
COPY ....
0\t1\t2\t....

This isn't a hard problem but since there are specific thing where the
column types aren't known in advance there isn't any prebuilt tool for
this. Mostly you get to write it yourself. It's short - just do it.


Joshua b. Jore ; http://www.greentechnologist.org

On Tue, 2 Jul 2002, robert kraus wrote:

> hi,
>
> I have multiple huge tab delimited txt files with >500
> columns which I want to import, The name of the
> columns is important, has to be the name of the column
> in the table and is always very long. The copy command
> seems to work only with predefined tables. How do I
> import the tables with column names ?
>
> thank you very much for your answer
> robert




pgsql-novice by date:

Previous
From: Andrew McMillan
Date:
Subject: Re: sequences what does ::text mean ?
Next
From: Josh Jore
Date:
Subject: Re: sequences what does ::text mean ?