I have a list in python which is product of a query to Google’s Datastore, the list looks like this:
[<Entity('User', 1111) {'refreshToken': 'xxx', 'firstName': 'Bill', 'lastName': 'Last', 'accessToken': 'xxx', 'idToken': 'xxx', 'email': 'the_email'}>]
I need to extract the ID of the entity which is 1111
. I’ve tried the following with no success thus far:
result = list(query.fetch()) print(result[0][0]) #fails print(result[0].Entity) #fails print(result[0]['User']) #fails print(result['User']) #fails
Any idea how I might be able to retrieve the ID value?
Advertisement
Answer
entity = result[0] print(entity.id)