[Q] PyGreSQL

Mart van de Wege mvdwege.usenet at drebbelstraat20.dyndns.org
Mon Oct 1 07:50:53 EDT 2001


In <jlvt7.1464$sc.18887 at vixen.cso.uiuc.edu>, Seung-won Hwang wrote:

<snip question 1> 
> (2) What's the easiest way to load tab-separated text data to the relational
> database? Any easier way than writing a program that calls "INSERT INTO" for
> every data value?
> 
Assuming you are running PostgreSQL, use the 'COPY FROM' SQL command. I believe
it defaults to tabs as field seperators, otherwise you can define that in the
command. <Digs up PostgreSQL book>Yep that's it. First do a 'CREATE TABLE' to
define the columns, then 'COPY <tablename> FROM <filename>' will fill it.
You might want to check out http://www.postgresql.org/docs/awbook.html for
Bruce Momjian's book.

Mart

-- 
Requiem aeternam dona eis, Domine, et lux perpetua luceat eis.
Requiescant in pace.
Amen.



More information about the Python-list mailing list