Reputation: 194
I currently have the ID attribute for an ndb entity. I can't seem to get the entity. I only know how to get the entity with the key name. This is what i have to try and reference it:
story = ndb.Key(Place, data['entryKey']).get()
Upvotes: 0
Views: 123
Reputation: 9116
There is a get_by_id method
get_by_id(id, parent=None, app=None, namespace=None, **ctx_options)
Returns an entity by ID. This is really just a shorthand for Key(cls, id).get().
But it seems it is shorthand for what you are currently doing anyway.
https://cloud.google.com/appengine/docs/python/ndb/modelclass#Model_get_by_id
Upvotes: 2