In this chapter, we started with the need for data modeling and examined how to model data using the
ndb's Model class. Then we dived into how it is stored internally, with all the properties serialized into a single column. Next we examined in detail how datastore constructs unique row keys for an entity by using the application ID, the current namespace, the Kind (the model's class name), and a unique identifier. We also studied how the identifier can be either a string or an integer. In the case it is an integer, we learned that datastore generates numeric IDs, and we can allocate our own range of IDs as well if we want to.
Next we examined the
ndb.Key class and how it allows us to weld keys together to achieve some interesting effects. We introduced two approaches to modeling data. The first approach included the key of another entity as its property. The other approach included the key as a part of the entity's key itself. We compared both approaches briefly, and then moved on...