Re: [GENERAL] bulk loader

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [GENERAL] bulk loader

Douglas McNaught
Hrishikesh Deshmukh <[hidden email]> writes:

> Hi All,
>
> Is there a "bulk loader" in postgresql with which one can read in say
> a tab delimited format text file. Before one does all one has to do is
> create the table with text file column names as attributes, once it is
> on DBMS world it will be a simple table (non-relational)!!!!

Read up on the COPY command.

-Doug

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq
Reply | Threaded
Open this post in threaded view
|

Re: [GENERAL] bulk loader

Brent Wood


On Thu, 19 May 2005, Hrishikesh Deshmukh wrote:

> Hi All,
>
> Is there a "bulk loader" in postgresql with which one can read in say
> a tab delimited format text file. Before one does all one has to do is
> create the table with text file column names as attributes, once it is
> on DBMS world it will be a simple table (non-relational)!!!!

See copy


from memory, pretty much as in:

cat <file> | \
  psql -d $DB -c "copy <table> from STDIN [with delimiter ','];"

You'll see that db users can't copy a file into a table but can copy
STDIN, so this approach works well.

Brent Wood

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [hidden email])
Reply | Threaded
Open this post in threaded view
|

Re: [GENERAL] bulk loader

Chris Browne
In reply to this post by Douglas McNaught
After takin a swig o' Arrakan spice grog, [hidden email] (Hrishikesh Deshmukh) belched out:
> Is there a "bulk loader" in postgresql with which one can read in say
> a tab delimited format text file. Before one does all one has to do is
> create the table with text file column names as attributes, once it is
> on DBMS world it will be a simple table (non-relational)!!!!

There is the built in "COPY" command which can do this sort of thing.

Jan Wieck wrote a "load" tool that does a more sophisticated job of
slicing up the data.  Look at pgFoundry.org for "pgloader".  There are
thoughts of trying to make this work much like Oracle's SQL*Loader
product.
--
wm(X,Y):-write(X),write('@'),write(Y). wm('cbbrowne','gmail.com').
http://linuxdatabases.info/info/postgresql.html
FLORIDA: We've been Gored by the bull of politics and we're Bushed.

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq