In certain database technologies, for any attribute inside a record, you are able to guarantee originality of this attribute inside the entire database. A good example of this can be a email_address attribute inside a User record. By setting email_address to unique, you guarantee that the particular current email address are only able to come in one record within the entire database.

Can there be any means by google application engine to possess unique qualities for any given model? Like a example, could I've got a User(db.Model) entity having a email property that's guaranteed unique over the entire datastore?

I discovered this resource here, that might prove useful.

The only real help you to get from GAE's datastore regarding "originality" is by entities' secrets -- however, I begin to see the URL you quote also observed might shows one method to exploit this fact. To obtain anywhere beyond secrets, you have to perform your inspections at application level (before you decide to put an entity, or perhaps a switch to a distinctive group of qualities, you are making a appropriate query [[key-just for speed]] and appearance it pops up empty), but that will get pretty pricey (and difficult to create transaction-safe).

I personally use record.key().id() blogged how, Nick Johnson's blog has professional expert consultancy

I've implemented it within the following way by overriding the put method and taking advantage of the important thing.title

class Program(db.Model):
name = db.StringProperty("Title")
slug = db.StringProperty("Slug")
def put(self):
    if Program.get_by_key_name(self.slug):
        raise UniqueConstraintViolation("slug", self.slug)
    self._key_name = self.slug
    return db.Model.put(self)

class UniqueConstraintViolation(Exception):
def __init__(self, scope, value):
    super(UniqueConstraintViolation, self).__init__("Value '%s' is not unique within scope '%s'." % (value, scope, ))

I save the slug as key.title and when you consider adding another program it'll see if the important thing title already exist. It's most likely not really a nice way, im additionally a beginner at python / application engine.

This really is piece of content about somebody utilizing a assistant model:

Edit: I saw additionally you so long as article lol.