title: Appengine - Upgrading from standard DB to NDB - ReferenceProperties
body: <p>I have an AppEngine application that I am considering upgrading to use the NDB database. </p>
  
  <p>In my application, I have millions of objects that have old-style db references. I would like to know what the best migration path would be to get these ReferenceProperty values converted to KeyProperty values, or any other solution that would allow me to upgrade to NDB.</p>
  
  <p>(I am hoping for something that doesn't involve massive batch processing of all of the elements in the database and computing the KeyProperty based on the ReferenceProperty -- something elegant would be nice)</p>
  
  <p>Examples of models that I would like to upgrade from db.Model to ndb.Model are the following:</p>
  
  <pre><code>class UserModel(db.Model):
      ....
  
  class MailMessageModel(db.Model):
      m_text = db.TextProperty()   
      m_from = db.ReferenceProperty(reference_class = UserModel)
      m_to = db.ReferenceProperty(reference_class = UserModel)
  </code></pre>