Обсуждение: CSV Utility

Поиск
Список
Период
Сортировка

CSV Utility

От
Mike angelo
Дата:
Is there a Postgres utility that allows data contained in a CSV file to be loaded into the database?

Re: CSV Utility

От
bricklen
Дата:
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@yahoo.com> wrote:
> Is there a Postgres utility that allows data contained in a CSV file to be
> loaded into the database?
>
>

Re: CSV Utility

От
Guillaume Lelarge
Дата:
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

Re: CSV Utility

От
Steve Crawford
Дата:
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


Re: CSV Utility

От
Beena J P
Дата:
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@pinpointresearch.com>
To: "Mike angelo" <angelocmp@yahoo.com>
Cc: <pgsql-admin@postgresql.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@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin


Re: CSV Utility

От
Beena J P
Дата:
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 -----
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?