The DataStore in the Google App Engine is really very different from a relational database. There are several similarities, but it is important to understand the differences when developing a data model.
As you usually define this type of relationship, use reference properties:
class Customer(db.Model): name = db.StringProperty() class Order(db.Model): customer = db.ReferenceProperty( Customer, collection_name = 'orders' )
The ReferenceProperty in the definition of the order object leads to the creation of a property in the Customer object with the name "orders", so if the "customer" is an instance of Customer, you can find all orders by contacting the "customer". orders.
For instance:
customer = Customer.gql("WHERE name = :1", "Bob")[0]
Reference properties are documented here.
Another important concept to understand is the idea of ββEntity groups. Objects in Entity Groups are stored in the same node, and therefore they can be stored and retrieved more efficiently. They are also crucial to the use of transactions.
source share