views:

35

answers:

1

Google is proposing changing one entry at a time to the default values ....

http://code.google.com/appengine/articles/update_schema.html

I have a model with a million rows and doing this with a web browser will take me ages. Another option is to run this using task queues but this will cost me a lot of cpu time

any easy way to do this?

+2  A: 

Because the datastore is schema-less, you do literally have to add or remove properties on each instance of the Model. Using Task Queues should use the exact same amount of CPU as doing it any other way, so go with that.

Before you go through all of that work, make sure that you really need to do it. As noted in the article that you link to, it is not the case that all entities of a particular model need to have the same set of properties. Why not change your Model class to check for the existence of new or removed properties and update the entity whenever you happen to be writing to it anyhow.

Adam Crossland
Thanks! but how do I check in the model for a non-existent newer property? I want to run a query on the model with the new property and this does not work for the older entites which have not been updated with this new property
demos
Any query that uses a property that does not exist on all entities will not return any entities that do not have the property. You can check for the presence of the property with the hasattr function if you are using Python.
Adam Crossland
so if I wanted to rename an existing property I would have to A) add a new property with the new name, B) copy the data over from old property to new property, then C) delete old property? ugh...
Nick Franceschina
@nickfranceschina: Renaming a property of a datastore entity is an extremely costly operation with very little payback. Since the entities are internal to your application, why would you bother renaming them?
Adam Crossland
@adam: I dunno... sh!t happens sometimes and might have to rename them for consistency/ease-of-understanding. just trying to understand the pitfalls
Nick Franceschina