Beispiel #1
0
class Human2(ndb.Model):
    name = ndb.StringProperty("na", indexed=True)
    gender = ndb.msgprop.EnumProperty(Gender, "g", required=True, indexed=True)
    age = ndb.IntegerProperty("ag", indexed=False)
    items = ndb.StructuredProperty(Items, "i", required=True)
    numbers = ndb.JsonProperty('json', indexed=False)
    description = ndb.TextProperty("t", indexed=False)
    description2 = ndb.TextProperty("t2", compressed=True, indexed=False)
    meters_tall = ndb.FloatProperty("mtrs", indexed=False)
    datetime_of_birth = ndb.DateTimeProperty("dtb", indexed=False)
    date_of_birth = ndb.DateProperty("db", indexed=False)
    time_of_birth = ndb.TimeProperty("tb", indexed=False)
    hobbies = ndb.StringProperty('hob', repeated=True, indexed=False)
    pickle = ndb.PickleProperty('pi', indexed=False)
    binary = ndb.BlobProperty("bi", indexed=False)
    home = ndb.GeoPtProperty("ho", indexed=False)
    generic = ndb.GenericProperty("gen", indexed=False)
    model = ndb.LocalStructuredProperty(Items, "mo", indexed=False)
    person_details = ndb.msgprop.MessageProperty(person_pb2.Person, "pd")
    key_prop = ndb.KeyProperty(Department)
    key_prop2 = ndb.KeyProperty()

    number_of_hobbies = ndb.ComputedProperty(
        name="num_hob", func=lambda self: len(self.hobbies), indexed=False)
    default_info = ndb.StringProperty("di", indexed=False, default='unknown')
    update = ndb.DateTimeProperty("up", indexed=False, auto_now=True)

    def _pre_put_hook(self):
        pass
Beispiel #2
0
class B(ndb.Model):
    c = ndb.IntegerProperty()
    d = ndb.IntegerProperty()
Beispiel #3
0
class Department(ndb.Model):
    department_id = ndb.IntegerProperty()
    name = ndb.StringProperty()
Beispiel #4
0
class Items(ndb.Model):
    has_hat = ndb.BooleanProperty("hh")
    number_of_socks = ndb.IntegerProperty("ns")
Beispiel #5
0
class ListUnindexed(ndb.Model):
    # top-level model
    a = ndb.IntegerProperty(repeated=True, indexed=False)
Beispiel #6
0
class Person2(ndb.Model):
    name = ndb.TextProperty(indexed=True)
    age = ndb.IntegerProperty(indexed=True)