Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Google App Engine

You're reading from   Mastering Google App Engine Build robust and highly scalable web applications with Google App Engine

Arrow left icon
Product type Paperback
Published in Oct 2015
Publisher
ISBN-13 9781784396671
Length 368 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

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, then the key cannot be specified. We have used it in some of our examples.
  • Key: You can specify the whole key yourself using the key keyword argument. If you are supplying the ndb.Key instance, the ID and parent cannot be supplied...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime