Adding a pre-filled column in Google App Engine
I want to add a int column to existing Google App Engine 开发者_开发技巧entity which should be pre-filled with default values (for e.g. 1) for existing records. I have about 12K records. I could not find a easy way to do this. Are there any tools available to do this simple functionality. Please advice.
thanks, Dave
To do this, you'd need to iterate over all existing records and update them to include the new value.
You can do this with the mapper API or remote_api.
The underlying datastore is schemaless meaning that two entities of the same kind can have different fields. So yiu have to iterate though all the old entries in your datastore and add that field.
Make sure that you stay within the 30 seconds limit (with 12k entries you should be over it) or else you have to split your work in small chunks and use task queue to execute it.
精彩评论