Re: CSV Utility

Lists: pgsql-admin
From: Mike angelo <angelocmp(at)yahoo(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: CSV Utility
Date: 2009-08-06 21:27:22
Message-ID: 957531.63955.qm@web110305.mail.gq1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

Is there a Postgres utility that allows data contained in a CSV file to be loaded into the database?


From: bricklen <bricklen(at)gmail(dot)com>
To: Mike angelo <angelocmp(at)yahoo(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: CSV Utility
Date: 2009-08-06 21:29:00
Message-ID: 33b743250908061429h319c28abr61b1d42fdf02dad2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

Take a look at the "CSV" option of "COPY". That should do what you're after.

http://www.postgresql.org/docs/8.4/interactive/sql-copy.html

On Thu, Aug 6, 2009 at 2:27 PM, Mike angelo<angelocmp(at)yahoo(dot)com> wrote:
> Is there a Postgres utility that allows data contained in a CSV file to be
> loaded into the database?
>
>


From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: pgsql-admin(at)postgresql(dot)org
Cc: bricklen <bricklen(at)gmail(dot)com>, Mike angelo <angelocmp(at)yahoo(dot)com>
Subject: Re: CSV Utility
Date: 2009-08-06 21:30:57
Message-ID: 200908062330.57965.guillaume@lelarge.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

Le jeudi 6 août 2009 à 23:29:00, bricklen a écrit :
> Take a look at the "CSV" option of "COPY". That should do what you're
> after.
>
> http://www.postgresql.org/docs/8.4/interactive/sql-copy.html
>

You can also use pgloader, a great python tool.

--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com


From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: Mike angelo <angelocmp(at)yahoo(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: CSV Utility
Date: 2009-08-06 21:40:16
Message-ID: 4A7B4DC0.9080509@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

Mike angelo wrote:
> Is there a Postgres utility that allows data contained in a CSV file
> to be loaded into the database?
>
You mean like psql?

\copy tablename from csvfilename CSV

or with a header:
\copy tablename from csvfilename CSV HEADER

or an alternate delimiter:
\copy tablename from csvfilename CSV delimiter '|'

or export data (tab-delimited):
copy foo to stdout CSV DELIMITER E'\t';

Cheers,
Steve


From: Beena J P <beena(dot)jp(at)nic(dot)in>
To: Mike angelo <angelocmp(at)yahoo(dot)com>, pgsql-admin(at)postgresql(dot)org
Subject: Re: CSV Utility
Date: 2009-08-07 05:11:46
Message-ID: 003b01ca171d$8fe991e0$3702a20a@Beena
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

Command to import data from text file to postgresql table
1. Create table of the same order os text file. Then execute the command at Query analyser.

copy tablename from textname (with path) CSV
eg: copy friends.office1 from 'C:/FRIENDS/ksebsouth.txt' CSV

regards
Beena

----- Original Message -----
From: Mike angelo
To: pgsql-admin(at)postgresql(dot)org
Sent: Friday, August 07, 2009 2:57 AM
Subject: [ADMIN] CSV Utility

Is there a Postgres utility that allows data contained in a CSV file to be loaded into the database?


From: Beena J P <beena(dot)jp(at)nic(dot)in>
To: Steve Crawford <scrawford(at)pinpointresearch(dot)com>, Mike angelo <angelocmp(at)yahoo(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: CSV Utility
Date: 2009-08-07 05:12:15
Message-ID: 004401ca171d$a17302c0$3702a20a@Beena
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

Command to import data from text file to postgresql table
1. Create table of the same order os text file. Then execute the command at
Query analyser.

copy tablename from textname (with path) CSV
eg: copy friends.office1 from 'C:/FRIENDS/ksebsouth.txt' CSV

regards
Beena
----- Original Message -----
From: "Steve Crawford" <scrawford(at)pinpointresearch(dot)com>
To: "Mike angelo" <angelocmp(at)yahoo(dot)com>
Cc: <pgsql-admin(at)postgresql(dot)org>
Sent: Friday, August 07, 2009 3:10 AM
Subject: Re: [ADMIN] CSV Utility

> Mike angelo wrote:
>> Is there a Postgres utility that allows data contained in a CSV file to
>> be loaded into the database?
>>
> You mean like psql?
>
> \copy tablename from csvfilename CSV
>
> or with a header:
> \copy tablename from csvfilename CSV HEADER
>
> or an alternate delimiter:
> \copy tablename from csvfilename CSV delimiter '|'
>
> or export data (tab-delimited):
> copy foo to stdout CSV DELIMITER E'\t';
>
> Cheers,
> Steve
>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin