[OSM-dev] Import planet.osm to rails
brett at bretth.com
Wed Aug 1 23:58:23 BST 2007
I've just noticed the same problem. The latest schema changes make the
user_id field mandatory which breaks Osmosis.
I'm working on a fix but it might take a day or two. I'm going to
modify Osmosis to create a "system" user that it will use when updating
In the meantime, Frederik's suggestions are good. Either make the field
nullable and populate it after load, or modify the field to have a
default value, whichever is easiest and works. I haven't done this yet
so hopefully there aren't any other changes that will break it.
Alternatively, if you wish to get something working quickly, the older
schema available here should work but you may have to search and replace
"latin1" with "utf8".
If anybody wants to try the latest schema, I've created a new dump.
I've fixed my local database to use utf8 so the mysqldump script below
Can anybody provide a suitable insert statement for creating a user that
is valid but can't log in? I'm currently aiming to use the following
INSERT INTO users (
email, token, active, pass_crypt,
creation_time, timeout, display_name, data_public,
description, home_lat, home_lon, within_lat,
) VALUES (
'osmosis at bretth.com', '', 1, '00000000000000000000000000000000',
NOW(), NOW(), 'Osmosis System User', 1,
'System user for the Osmosis toolset.', 0, 0, 0,
Frederik Ramm wrote:
>> 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
> 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).
More information about the dev