title: Link Kinds Google App Engine using Python
body: <p>I am new to app engine and I am trying to get my head around linking two kinds together, even after reading the documentation I am still approaching it too much from a relationship database model I think.</p>
  
  <p>If I have a UserInformation class</p>
  
  <pre><code>class UserInformation(ndb.Model):
      username = ndb.UserProperty()
      firstname = ndb.StringProperty(required=True)
      lastname = ndb.StringProperty(required=True)
      telephone = ndb.IntegerProperty()
      email = ndb.StringProperty()
  </code></pre>
  
  <p>and then I want to have a book class so that a user can have multiple books</p>
  
  <pre><code>class Book(ndb.Model):
      author = ndb.StringProperty(required=True)
      booktitle = ndb.StringProperty(required=True)
  </code></pre>
  
  <p>how do I link the two classes together with a parent / child relationship? Is it something like</p>
  
  <pre><code>b = Book(parent=UserInformation, key=’some key’, author=’some author’, booktitle=’a great book’)
  </code></pre>
  
  <p>If it is, how do I extract the key? I can get the ID by</p>
  
  <pre><code>Users = UserInformation(UserInformation.username==’some user’).get()
  User_key = Users.key.id()
  </code></pre>
  
  <p>But I can’t seem to get the key?</p>
  
  <p>Any help gratefully received </p>