Fabien Warniez
Fabien Warniez

Reputation: 2741

What is the Entity Key for in the Datastore Viewer?

I am new to Google App Engine, Python and NoSQL.

While browsing the Datastore Viewer I noticed that there is a key labelled "Key" in the list view, and "Entity Key" in the single entity edit view, which is generated automatically.

What is it for? Should I use this to identify my entities? Or should I just ignore it? Is it an internal key used by App Engine?

Any light shed on this would be much appreciated!

Thanks

UPDATE:

Here is a screenshot of what is confusing me: http://snag.gy/J7ISd.jpg

From left to right in the table there is "Key" (the one that I am asking about), "Write Ops", "ID", "Key Name". My question is, what is "Key" used for?

UPDATE 2:

Tim Hoffman answered my question in the comment. The "Key" column is the url safe version of the whole key.

So to sum up, the key of an entity is composed of either a numeric ID or a string key, AND each entity also has a url safe version that can be passed around the URLs, that is automatically generated.

Upvotes: 1

Views: 635

Answers (1)

Peter Knego
Peter Knego

Reputation: 80340

Datastore entities are represented by their unique key. As the docs state, each entity in the Datastore has a key that uniquely identifies it. The key consists of the following components:

  • The kind of the entity, which categorizes it for the purpose of Datastore queries
  • An identifier for the individual entity, which can be either a key name string an integer numeric ID
  • An optional ancestor path locating the entity within the Datastore hierarchy

Upvotes: 1

Related Questions