Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9241113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:18:42+00:00 2026-06-18T08:18:42+00:00

I have an AppEngine application that I am considering upgrading to use the NDB

  • 0

I have an AppEngine application that I am considering upgrading to use the NDB database.

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.

(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)

Examples of models that I would like to upgrade from db.Model to ndb.Model are the following:

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)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:18:43+00:00Added an answer on June 18, 2026 at 8:18 am

    Good news, you don’t have to make any changes to your persisted data, as ext.db and ndb read and write the exact same data.

    Here’s the quote from the NDB Cheat Sheet:

    No Datastore Changes Needed!

    In case you wondered, despite the different APIs, NDB and the old ext.db package write exactly the same data to the Datastore. That means you don’t have to do any conversion to your datastore, and you can happily mix and match NDB and ext.db code, as long as the schema you use is equivalent. You can even convert between ext.db and NDB keys using ndb.Key.from_old_key() and key.to_old_key().

    The cheat sheet is a great guide to convert your model definitions. For example, changing your MailMessageModel should be as easy as:

    before:

    class MailMessage(db.Model):
        m_text = db.TextProperty()
        m_from = db.ReferenceProperty(reference_class=UserModel)
        m_to = db.ReferenceProperty(reference_class=UserModel)
    

    after:

    class MailMessage(ndb.Model):
        m_text = ndb.TextProperty()
        m_from = ndb.KeyProperty(kind=UserModel)
        m_to = ndb.KeyProperty(kind=UserModel)
    

    I highly recommend using the cheat sheet to assist you with your migration.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application hosted in Java on AppEngine and I would like to
I have a ~2MB file that my Google AppEngine server must use (not serve)
I have an AppEngine application that uses the blobstore to store user-provided image data.
I have a Google Appengine/Guice/Wicket Application. My problem is that due to the mapping
I have configured Appstats on my Java Appengine application and noticed that a single
I have an application that uses Python appengine, there is a service that updates
I have an appengine application that allows users to register themselves. These users must
I have an application running on AppEngine that uses about 50 CPU hours a
I have a simple Hello World application in Python that i'm using with AppEngine,
I have an AppEngine application that currently has about 15GB of data, and it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.