I am using named key for an ndb entity:
entity = MyEntity(id='MyNamedKey', count=mycount)
When I get the entity from the datastore the key for the entity is of type “Key” and looks like this:
Key('MyEntity', 'MyNamedKey')
What would be a good way to get the “MyNamedKey” part from the key?
I tried the following but its probably not the right way to do it
entity.key._Key__pairs[0][1]
Thanks!
Based on a cursory reading of NDB Key Class, looks like the
id()orstring_id()methods would be appropriate.