The model

We have been using ndb.Model so far, but didn't look at the class in detail. The following are the three groups of things that we need to look into:

  • The constructor
  • The class methods
  • The instance methods

Let's look at these in turn.

The constructor

We have been using constructor throughout our examples, as follows:

Listing(title="Civic 1995 for Sale")

What can you pass to the constructor? Basically, all the properties that you declared on the model itself can be supplied as keyword arguments for initial values while creating the instance. Besides this, the following can be supplied:

  • ID: This is either an integer or a string that you wish to use as an identifier instead of the autogenerated one using the id keyword argument. If an ID is provided, ...

Get Mastering Google App Engine now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.