Paul
Paul

Reputation: 1242

How do you select a gae entity's key_name?

I want to retrieve all of my Class entities key_names and not the Key.

Is there a way to do this with gae?

Here is my current code:

entities = db.GqlQuery("SELECT __key_name__ FROM Class").fetch(1000)
logging.info(entities)

which of course dosen't work because there is no property key_name. Does anyone know how to get the same effect?

I know how to return the Key property but what I want is the key_name.

Upvotes: 1

Views: 83

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599610

The key contains the key name, of course. So when you've got a list of keys, you can call name() on each of them to get the name component.

Upvotes: 3

Related Questions