GAE Key Storage vs. StringID

Are there any advantages to storing keys row by row in the Google App Engine datastore.

For instance:

class Model(ndb.Model):
    user_key = ndb.KeyProperty()

VS

class Model(ndb.Model):
    user_id = ndb.StringProperty()
  • Why do you want to save the key instead of StringID? Is this just for convenience?
  • What uses less storage space?
  • What is faster to request?
+5
source share
1 answer

If you use entity groups (ancestors), KeyProperty will support this. When saving an identifier, if the model whose identifier you are saving is the root of a group of objects, you need to save enough information to restore the full key.

KeyProperty , , . .

+5

All Articles