![]() |
App Engine Python SDK
v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
|
Public Member Functions | |
def | __init__ |
def | __getstate__ |
def | __setstate__ |
def | __repr__ |
def | __hash__ |
def | __eq__ |
![]() | |
def | __ne__ |
A class describing datastore entities. Model instances are usually called entities. All model classes inheriting from Model automatically have MetaModel as their metaclass, so that the properties are fixed up properly after the class once the class is defined. Because of this, you cannot use the same Property object to describe multiple properties -- you must create separate Property objects for each property. E.g. this does not work: wrong_prop = StringProperty() class Wrong(Model): wrong1 = wrong_prop wrong2 = wrong_prop The kind is normally equal to the class name (exclusive of the module name or any other parent scope). To override the kind, define a class method named _get_kind(), as follows: class MyModel(Model): @classmethod def _get_kind(cls): return 'AnotherKind'
def google.appengine.ext.ndb.model.Model.__init__ | ( | args, | |
kwds | |||
) |
Creates a new instance of this model (a.k.a. an entity). The new entity must be written to the datastore using an explicit call to .put(). Keyword Args: key: Key instance for this model. If key is used, id and parent must be None. id: Key id for this model. If id is used, key must be None. parent: Key instance for the parent model or None for a top-level one. If parent is used, key must be None. namespace: Optional namespace. app: Optional app ID. **kwds: Keyword arguments mapping to properties of this model. Note: you cannot define a property named key; the .key attribute always refers to the entity's key. But you can define properties named id or parent. Values for the latter cannot be passed through the constructor, but can be assigned to entity attributes after the entity has been created.
def google.appengine.ext.ndb.model.Model.__eq__ | ( | self, | |
other | |||
) |
Compare two entities of the same class for equality.
def google.appengine.ext.ndb.model.Model.__hash__ | ( | self | ) |
Dummy hash function. Raises: Always TypeError to emphasize that entities are mutable.
def google.appengine.ext.ndb.model.Model.__repr__ | ( | self | ) |
Return an unambiguous string representation of an entity.