App Engine Python SDK  v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
Public Member Functions | Static Public Attributes | List of all members
google.appengine.ext.ndb.model.Model Class Reference
Inheritance diagram for google.appengine.ext.ndb.model.Model:
google.appengine.ext.ndb.model._NotEqualMixin google.appengine.ext.ndb.blobstore.BlobInfo google.appengine.ext.ndb.metadata._BaseMetadata google.appengine.ext.ndb.model.Expando google.appengine.ext.ndb.polymodel.PolyModel google.appengine.ext.ndb.stats.BaseStatistic google.appengine.ext.ndb.metadata.EntityGroup google.appengine.ext.ndb.metadata.Kind google.appengine.ext.ndb.metadata.Namespace google.appengine.ext.ndb.metadata.Property google.appengine.ext.ndb.stats.BaseKindStatistic google.appengine.ext.ndb.stats.GlobalStat google.appengine.ext.ndb.stats.KindCompositeIndexStat google.appengine.ext.ndb.stats.NamespaceStat google.appengine.ext.ndb.stats.PropertyTypeStat

Public Member Functions

def __init__
 
def __getstate__
 
def __setstate__
 
def __repr__
 
def __hash__
 
def __eq__
 
- Public Member Functions inherited from google.appengine.ext.ndb.model._NotEqualMixin
def __ne__
 

Static Public Attributes

 key = _key
 
 populate = _populate
 
 has_complete_key = _has_complete_key
 
 to_dict = _to_dict
 
 query = _query
 
 gql = _gql
 
 put = _put
 
 put_async = _put_async
 
 get_or_insert = _get_or_insert
 
 get_or_insert_async = _get_or_insert_async
 
 allocate_ids = _allocate_ids
 
 allocate_ids_async = _allocate_ids_async
 
 get_by_id = _get_by_id
 
 get_by_id_async = _get_by_id_async
 

Detailed Description

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'

Constructor & Destructor Documentation

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.

Member Function Documentation

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.

The documentation for this class was generated from the following file: