There's no concept of a global schema for datastore entities, so entities are responsible for managing defining their own fields. For this reason, you cannot add fields if your requirement is that they are non-empty without iterating through each entity and updating it. An alternative solution could be to version new entities and grandfather old entities, updating them as they are read if they are not up to date.
I wouldn't say that this isn't a scalable solution. It's only non-scalable if you are determined to have all your entities share the same fields. Distributed key-value stores are powerful precisely because they are effectively typeless, allowing for more flexible strategies to migrate entity definitions. On a relational database, it's basically doing the same thing if you set a default value - it's just that the database handles it for you. Often times this will result in downtime or a degraded state for a long period of time if you have an enormous dataset. On Tue, Apr 13, 2010 at 2:01 PM, laserjim <[email protected]> wrote: > Hey, > > So, I define some entity Foo, and create a hundred thousand instances > of it. Now I want to add a variable of entity type Bar, and want to > specify a default value. Null may be a valid value, but is not the > default. > > One solution I've seen around the intertubes is to write a script that > iterates through all the objects in the datastore and manually > performs the update operations on the untyped records. This seems non- > ideal. Too much developer overhead for minor changes, not clean, and > not very scalable. > > Are there better solutions, or is this basically the de-facto > standard? > > Thanks! > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-appengine-java%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > -- Ikai Lan Developer Programs Engineer, Google App Engine -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
