Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is almost certainly done best outside the database, using a script in your choice of language. I'd use Python and psycopg2, but things like Ruby + the Pg gem, Perl and DBI / DBD::Pg, or even PHP and PDO, are equally reasonable choices.</p> <p>Your code can do an HTTP fetch, then (if it's CSV-like) use the <code>COPY</code> command to load the data into PostgreSQL. If it's a shapefile, you can feed the data to <a href="http://postgis.net/" rel="nofollow noreferrer">PostGIS</a>'s <code>shp2pgsql</code> loader, or make individual <code>INSERT</code>s using the <code>GeomFromText</code> PostGIS function.</p> <p>You could do the HTTP fetch from a PL/Pythonu or PL/Perlu stored procedure, but there'd be no real benefit over just doing it from a script, and it'd be more robust as an external script.</p> <p>So, really, you need to split this problem up.</p> <p>You'll need code to talk to the website(s) of interest, possibly including things like HTTP POSTs to submit forms. Or, preferably, use a <a href="http://en.wikipedia.org/wiki/Web_API" rel="nofollow noreferrer">web API</a> for the site(s) that's designed for automatic scripted interaction. Most simple RESTful APIs are easy to use from scripting languages using libraries like Perl's LWP, Python's httplib, etc. In the case of the site you linked to, as <a href="https://stackoverflow.com/users/623952/user623952">user623952</a> mentioned, there's a <a href="http://www.marineregions.org/gazetteer.php?p=webservices" rel="nofollow noreferrer">RESTful API</a>.</p> <p>Then you'll need code to fetch the data of interest, and code to read the fetched data and load it into PostgreSQL. You might want to download all the data then load it, or you may want to stream it into the database as it's downloaded (pipe to <code>shp2pgsql</code>, etc).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload