title: Duplicating key names and parent as properties in Google App Engine (GAE) Datastore?
body: <p>After reading about the GAE Datastore API, I am still unsure if I need to duplicate key names and parents as properties for an entity. </p>
  
  <p>Let's say there are two kinds of entities: Employee and Division. Each employee has a division as its <strong>parent</strong>, and is identified by an account name. I use the account name as the <strong>key name</strong> for employees. But when modeling Employee, I would still keep these two as properties:</p>
  
  <pre><code>division = db.ReferenceProperty(Division)
  account_name = db.StringProperty()
  </code></pre>
  
  <p>Obviously I have to manually keep <code>division</code> consistent with its parent, and <code>account_name</code> with its key name. The reasons I am doing this extra work are:</p>
  
  <ol>
  <li>I am afraid GQL/Datastore API may not support parent and key name as well as normal property. Is there anything I can do about a property but not parent or key name (or are they essentially reference properties)? How do I use key names in GQL queries?</li>
  <li>The meaning of key name and parent is not particularly clear. As the names are not self-descriptive, I have to inform other contributors that we use account name as key name...</li>
  </ol>
  
  <p>But this is really unnecessary work, wasting time and storage space. I cannot get rid of the SQL-thinking that - why doesn't Google just let us define a property to be the key? and another to be the parent? Then we could name them and use as normal properties... </p>
  
  <p>What's the best practice here?</p>