I am working on a project using the gcloud cli tools. I am using Python + Flask for developing the application. My main reference points have been the Google Datastore documentation as well this How-to tutorial guide.
I have some entities in my Datastore and these entities have some properties. Entities are created in the application, with the Key set to the default Key (a.k.a incomplete key).
I am able to access the entities alright. And using projection, I can also access the properties of each entity. However, is there a way to only extract the Key from an entity? Example:
>>> print(list(user_query.fetch()))
[<Entity('User', 5097358505279488) {...}>]
This works alright when I want to access the properties. However, I cannot access the key 509..
. I have also tried:
>>> for user in user_query.fetch():
print(user.key)
...
>>> <Key('User', 5097358505279488), project=...>
While it returns the whole Key object, I couldn't find a way to extract only the key. I have scoured the documentation for a solution, but it hasn't returned anything so. I am wondering if this is even possible at this point.