Thank you!

On Feb 2, 1:30 pm, "Nick Johnson (Google)" <[email protected]>
wrote:
> Hi Albert,
>
>
>
>
>
>
>
>
>
> On Wed, Feb 2, 2011 at 12:44 PM, Albert <[email protected]> wrote:
> > Hi!
>
> > I just migrated to the High Replication datastore.
>
> > Some of my entities contain stringified keys of other entities.
>
> > For example:
>
> > Entity(db.Model):
> > owner = db.StringProperty() # the str(Key) of the owner.
>
> > Owner(db.Model):
> > name = db.StringProperty()
>
> > Now that I've migrated to the high-replication datastore, all the
> > stringified keys in the Entity Model contain bad keys because the
> > Owner Entities have new keys now.
>
> The migration tool rewrites the App ID of keys, but only if they're stored
> as keys (or reference properties). This is one reason why you shouldn't
> store stringified keys in the datastore!
>
> > 2 questions:
>
> > 1. Would this have been prevented by using db.ReferenceProperty()
> > instead?
>
> Yes.
>
> > 2. How can I resolve this issue? I need to update all entities to
> > contain the new keys instead.
>
> You should probably use the mapreduce library. For your mapper function,
> deserialize the key, and construct a new one with the correct App ID (you
> can simply use db.Key.from_path to do this, as it will fill in the App ID
> for you) then store it again. You might want to move to using
> ReferenceProperties when you do this.
>
> -Nick Johnson
>
> > Thanks!
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-appengine%2Bunsubscrib 
> > [email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine?hl=en.
>
> --
> Nick Johnson, Developer Programs Engineer, App Engine
> Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number:
> 368047

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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?hl=en.

Reply via email to