Thread: Importing data... (fwd)

Importing data... (fwd)

From
Chadwick Rolfs
Date:

---------- Forwarded message ----------
Date: Thu, 24 May 2001 12:23:52 -0400 (EDT)
From: Chadwick Rolfs <c2304182@webdevel.urban.csuohio.edu>
To: psql-novice@postgresql.org
Subject: Importing data...

Greetings!! I am trying to get a comma-delimited file to copy into a
postgres db.  Please help on the best way to do this.  I'm not sure on how
to create tables from a file like this, so any SQL or psql info will be
helpful, thanks..




Re: Importing data... (fwd)

From
harrold@sage.che.pitt.edu
Date:
On Thu, 24 May 2001, Chadwick Rolfs wrote:

>
>
> ---------- Forwarded message ----------
> Date: Thu, 24 May 2001 12:23:52 -0400 (EDT)
> From: Chadwick Rolfs <c2304182@webdevel.urban.csuohio.edu>
> To: psql-novice@postgresql.org
> Subject: Importing data...
>
> Greetings!! I am trying to get a comma-delimited file to copy into a
> postgres db.  Please help on the best way to do this.  I'm not sure on how
> to create tables from a file like this, so any SQL or psql info will be
> helpful, thanks..
>
>


http://www.postgresql.org/idocs/index.php?query-populate.html

i think this is what you are looking for.

--
john
Give a man a fish, he owes you one fish.
Teach a man to fish, you give up your monopoly on fisheries.


Re: Importing data... (fwd)

From
Chadwick Rolfs
Date:
Right, so I just create the empty tables, or put in the primary keys, then
I can use copy?
--  OR is there a way to get postgresql to make the tables
for me according to the CSV file???
That's what I'm really after.

Chadwick Rolfs

On Thu, 24 May 2001 harrold@sage.che.pitt.edu wrote:

> On Thu, 24 May 2001, Chadwick Rolfs wrote:
>
> >
> >
> > ---------- Forwarded message ----------
> > Date: Thu, 24 May 2001 12:23:52 -0400 (EDT)
> > From: Chadwick Rolfs <c2304182@webdevel.urban.csuohio.edu>
> > To: psql-novice@postgresql.org
> > Subject: Importing data...
> >
> > Greetings!! I am trying to get a comma-delimited file to copy into a
> > postgres db.  Please help on the best way to do this.  I'm not sure on how
> > to create tables from a file like this, so any SQL or psql info will be
> > helpful, thanks..
> >
> >
>
>
> http://www.postgresql.org/idocs/index.php?query-populate.html
>
> i think this is what you are looking for.
>
> --
> john
> Give a man a fish, he owes you one fish.
> Teach a man to fish, you give up your monopoly on fisheries.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://www.postgresql.org/search.mpl
>



Re: Importing data... (fwd)

From
harrold@sage.che.pitt.edu
Date:
On Thu, 24 May 2001, Chadwick Rolfs wrote:

> Right, so I just create the empty tables, or put in the primary keys, then
> I can use copy?
> --  OR is there a way to get postgresql to make the tables
> for me according to the CSV file???
> That's what I'm really after.
>
> Chadwick Rolfs
>

i think the copy command acts just like the insert command when it comes
to keys. so you create the table with the attrubutes found in the
cvs. then you use the copy command to insert the data. i think the
corresponding column in the text file will be copied into the key field,
and not generated automatically. although i'm not too sure on the last
part.

you could create a 3 column table with some sample data and try it out.

--
john
Give a man a fish, he owes you one fish.
Teach a man to fish, you give up your monopoly on fisheries.