Databases Reference
In-Depth Information
In addition to the common data types listed in Table 10-2, additional types are supported to defi ne
an entity key and to model Google accounts and typical communication identities that involve
e-mail, instant messaging, postal address, and phone number. Classes are also defi ned to model a
geographical point, a tag or a rating value. A data store key is modeled using the Key class in the
google.appengine.ext.db module. The additional supported types are as follows:
Google accounts users.User
Email db.Email
IM db.IM (Instant Messaging ID)
Postal address db.PostalAddress
Phone number db.PhoneNumber
Category db.Category
Link db.Link
Rating db.Rating
Geographical point db.GeoPt
While the Model class with the help of supported types allows you to precisely defi ne a desired data
schema, sometimes fl exibility in the model is important. You may also recall that the underlying
data store imposes no restrictions either in terms of a schema or data types. In other words, you are
allowed to add properties as required and the set of properties could vary between two entities of
the same kind. Also, two entities may choose to store a different data type for the same property.
In order to model such dynamic and fl exible schemas, the GAE Python API defi nes a model class
named Expando .
Google App Engine also offers a Blobstore, distinct from the data store. The
Blobstore service allows you to store objects that are too large for the data store.
A blob in the Blobstore is identifi ed by a blobstore.BlobKey. BlobKey(s) can be
sorted on byte order.
Expando
Properties can be of two types:
Fixed properties
Dynamic properties
Properties defi ned as attributes of a model class are fi xed properties. Properties added as attributes
to a model instance are dynamic properties.
A model instance, and not a class, persists as an entity.
Search WWH ::




Custom Search