How to just "link" to some data feed

From: "Albretch Mueller" <lbrtchx(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: How to just "link" to some data feed
Date: 2008-06-04 00:04:10
Message-ID: 9ef66fac0806031704g64c4169o5af4d4ae90955fab@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-jdbc

Hi,
~
I have some CSV files which I need to link to from within PG
~
From http://darkavngr.blogspot.com/2007/06/importar-datos-externos-nuestra-base-de.html
~
Say, you have the following data feed in /tmp/codigos_postales.csv
~
"01000","San Angel","Colonia","Alvaro Obregon","Distrito Federal"
"01010","Los Alpes","Colonia","Alvaro Obregon","Distrito Federal"
"01020","Guadalupe Inn","Colonia","Alvaro Obregon","Distrito Federal"
"01028","Secretaria de Contraloria y Desarrollo Administrativo","Gran
usuario","Alvaro Obregon","Distrito Federal"
"01029","Infonavit","Gran usuario","Alvaro Obregon","Distrito Federal"
"01030","Axotla","Pueblo","Alvaro Obregon","Distrito Federal"
"01030","Florida","Colonia","Alvaro Obregon","Distrito Federal"
"01040","Campestre","Colonia","Alvaro Obregon","Distrito Federal"
~
then you can defined the DB data model as:
~
CREATE TABLE codigos_postales(
cp char(5),
asentamiento varchar(120),
tipo_asentamiento varchar(120),
municipio varchar(120),
estado varchar(120)
);
~
and copy all values into the DB like this:
~
COPY codigos_postales FROM '/tmp/codigos_postales.csv' DELIMITERS ',' CSV;
~
But how do you just link to the data feed effectively keeping it in a
CSV file format not internal to PG?
~
Also I need for all changes to the data to (of course!) be propagated
to the data back end
~
Then you can link to the same data feed from some other engine that
reads in CSV (I think all do or should)
~
How do you link to a CSV using PG?
~
Thank you
lbrtchx

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Crawford 2008-06-04 00:10:43 Re: Generate SQL Statements
Previous Message Terry Lee Tucker 2008-06-03 23:06:21 Generate SQL Statements

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2008-06-04 00:24:47 Re: How to just "link" to some data feed
Previous Message Paul Lindner 2008-06-02 08:57:37 Postgresql JDBC UTF8 Conversion Throughput