Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products.

Python 3.10 is now generally available.


Property compatible with db.Model classes.

Inherits From: Property, expected_type

Add references to blobs to domain models using BlobReferenceProperty::

class Picture(db.Model):
  title = db.StringProperty()
  image = blobstore.BlobReferenceProperty()
  thumbnail = blobstore.BlobReferenceProperty()

To find the size of a picture using this model::

picture = Picture.get(picture_key)
print picture.image.size

BlobInfo objects are lazily loaded, so iterating over models for BlobKeys is efficient. The following sample code does not need to hit Datastore for each image key::

list_of_untitled_blobs = []
for picture in Picture.gql("WHERE title=''"):

verbose_name User friendly name of property.
name Storage name for property. By default, uses attribute name as it is assigned in the Model sub-class.
default Default value for property if none is assigned.
required Whether property is required.
validator User provided method used for validation.
choices User provided set of valid property values.
indexed Whether property is indexed.

Child Classes

class data_type



View source

Deprecated backwards-compatible accessor method for self.data_type.


View source

Default value for unassigned values.

Default value as provided by __init__(default).


View source

Determine if value is empty in the context of this property.

For most kinds, this is equivalent to "not value", but for kinds like bool, the test is more subtle, so subclasses can override this method if necessary.

value Value to validate against this Property.

True if this value is considered empty in the context of this Property type, otherwise False.


View source

Determine new value for auto-updated property.

Some properies (e.g. DateTimeProperty, UserProperty) optionally update their value on every put(). This call must return the new desired value for such properties. For all other properties, this call must return AUTO_UPDATE_UNCHANGED.

model_instance Instance to get new value for.

Datastore representation of the new model value in a form that is appropriate for storing in the datastore, or AUTO_UPDATE_UNCHANGED.


View source

Returns a model property translated to a datastore value.

model_instance The model property that you want to translate.

The model property that was translated from datastore.


View source

Returns a datastore value to BlobInfo.

value The datastore value that you want to translate.

A BlobInfo that was translated from datastore.


View source


View source

Validates that an assigned value is BlobInfo.

This method automatically converts from strings and BlobKey instances.

value The value that you want to validate.

Information about whether an assigned value is BlobInfo.

creation_counter 2