[OSM-dev] CSV tool for 0.5; target: plain SQL

Brett Henderson brett at bretth.com
Tue Oct 16 00:16:32 BST 2007


Stefan de Konink wrote:
> But it looks not yet compatible to Api 0.5. I would like to import the
> planet.osm in another database that only supports 'plain SQL'. Without
> fancy PostGIS or MySQL syntax. Currently I have used a sed regular
> expression to fish out nodes from the planet.osm file, but I would like
> to use a more decent way of converting. XQuery is my last resort...
>   
Hi Stefan,

I'm not too sure what you mean by "plain SQL".  Whatever SQL you produce 
will need to be targeted at a database schema and the only schema I'm 
aware of for holding all OSM types is the current MySQL schema.  What 
schema are you targeting?

Having said that, I'm not aware of any tool that will generate an SQL 
script regardless of whether it's tied to a particular database engine 
or not.

If I wanted to produce a SQL script I would write a new task for 
osmosis.  Using the existing MySqlWriter class as an example, it should 
be fairly simple to modify it to write SQL statements to a file instead 
of applying direct to a database.  That class is way more complicated 
than you need because it utilises a number of buffers and a bunch of 
logic to allow many rows to be inserted at once for performance reasons 
and does special table locking, etc but all of that could be ripped out 
in this case.  Osmosis would be very fast for this, reading a planet 
file and producing a file at the other end is its bread and butter.

Cheers,
Brett





More information about the dev mailing list