[OSM-dev] Import planet.osm to rails

Frederik Ramm frederik at remote.org
Wed Aug 1 23:36:05 BST 2007


Hi,

> For instance, I tried osmosis but it said: "java.sql.SQLException:
> Field 'user_id' doesn't have a default value".

I have successfully used osmosis just a few days ago. It seems to be the 
best way to go (for me at least). If you have the rails port running 
your should be able to create the schema using "rake migrate" or so, and 
then populate it with osmosis.

I didn't have the rails stuff running at the time so I used the SQL 
schema create script provided by Brent but I don't see why it should not 
be working with the rails-generated schema.

I did have the issue of user_id being NULL after osmosis imports, and 
had to manually create one user in my database and do an "update nodes 
set user_id=1" (and current_nodes, and segments and current_segements 
and ways and current_ways).

I guess it might be due to slightly different MySQL setups. I believe 
you can somehow have a "strict" and "not so strict" mode with 5.*, I 
don't know the exact details but maybe I was in not-so-strict mode where 
it works like in 4.*, using NULL even if there is no default value 
specified, while you're running it in strict mode and so NULL is not 
acceptable.

Switch to not-so-strict mode or do an "alter table ... change column 
user_id user_id integer default 1" or so for all tables having an 
user_id (that would nicely save you from having to do the update later on).

Bye
Frederik

-- 
Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00.09' E008°23.33'




More information about the dev mailing list