Advanced use of Datastore
We have already learned a lot about Datastore so far, including how to define entity kinds with model classes, the property concept, and how to make simple queries.
There is a lot more we can do with the NDB Python API to optimize an application, as we will see shortly.
More on properties – arrange composite data with StructuredProperty
In our Notes application, we defined the CheckListItem
model class to represent checkable items, and then we added a property to the Note
model named checklist_items
that references a list of that kind of entities. This is what we usually call a one-to-many relationship between notes and checklist items, and it is a common way to structure application data. By following this strategy, though, every time we add an item to a note, we have to create and store a new entity on Datastore. This is not a bad practice at all, but we have to take into consideration that we are charged for the use of Datastore depending on the number...