What's the difference between a parent and a reference property in Google App Engine?

google-app-engine, python

Solution

There are several differences:

- All entities with the same ancestor are in the same entity group. Transactions can only affect entities inside a single entity group.

- All writes to a single entity group are serialized, so throughput is limited.

- The parent entity is set on creation and is fixed. References can be changed at any time.

- With reference properties, you can only query for direct relationships, but with parent properties you can use the .ancestor() filter to find everything (directly or indirectly) descended from a given ancestor.

- Each entity has only a single parent, but can have multiple reference properties.

Problem

From what I understand, the parent attribute of a db.Model (typically defined/passed in the constructor call) allows you to define hierarchies in your data models. As a result, this increases the size of the entity group. However, it's not very clear to me why we would want to do that. Is this strictly for ACID compliance? I would like to see scenarios where each is best suited or more appropriate.

Original source