Blobstore

Provides an ndb interface for the blob store.

Initially, the blob store was an App Engine specific API for Google Cloud Storage.

No longer supported.

class google.cloud.ndb.blobstore.BlobFetchSizeTooLargeError(*args, **kwargs)[source]

Bases: object

class google.cloud.ndb.blobstore.BlobInfo(*args, **kwargs)[source]

Bases: object

classmethod get(*args, **kwargs)[source]
classmethod get_async(*args, **kwargs)[source]
classmethod get_multi(*args, **kwargs)[source]
classmethod get_multi_async(*args, **kwargs)[source]
class google.cloud.ndb.blobstore.BlobInfoParseError(*args, **kwargs)[source]

Bases: object

class google.cloud.ndb.blobstore.BlobKey(blob_key)[source]

Bases: object

Key used to identify a blob in the blobstore.

Note

The blobstore was an early Google App Engine feature that later became Google Cloud Storage.

This class is a simple wrapper a bytes object. The bytes represent a key used internally by the Blobstore API to identify application blobs (i.e. Google Cloud Storage objects). The key corresponds to the entity name of the underlying object.

Parameters

blob_key (Optional[bytes]) – The key used for the blobstore.

Raises
class google.cloud.ndb.blobstore.BlobKeyProperty(**kwds)[source]

Bases: google.cloud.ndb.model.Property

A property containing BlobKey values.

_validate(value)[source]

Validate a value before setting it.

Parameters

value (BlobKey) – The value to check.

Raises

BadValueError – If value is not a BlobKey.

IN(value)

For the in comparison operator.

The in operator cannot be overloaded in the way we want to, so we define a method. For example:

Employee.query(Employee.rank.IN([4, 5, 6]))

Note that the method is called _IN() but may normally be invoked as IN(); _IN() is provided for the case that a StructuredProperty refers to a model that has a property named IN.

Parameters

value (Iterable[Any]) – The set of values that the property value must be contained in.

Returns

A node corresponding to the desired in filter.

Return type

Union[DisjunctionNode, FilterNode, FalseNode]

Raises
__delete__(entity)

Descriptor protocol: delete the value from the entity.

Parameters

entity (Model) – An entity to delete a value from.

__eq__(value)

FilterNode: Represents the = comparison.

__ge__(value)

FilterNode: Represents the >= comparison.

__get__(entity, unused_cls=None)

Descriptor protocol: get the value from the entity.

Parameters
  • entity (Model) – An entity to get a value from.

  • unused_cls (type) – The class that owns this instance.

__gt__(value)

FilterNode: Represents the > comparison.

__le__(value)

FilterNode: Represents the <= comparison.

__lt__(value)

FilterNode: Represents the < comparison.

__ne__(value)

FilterNode: Represents the != comparison.

__neg__()

Return a descending sort order on this property.

For example:

Employee.query().order(-Employee.rank)
__pos__()

Return an ascending sort order on this property.

Note that this is redundant but provided for consistency with __neg__(). For example, the following two are equivalent:

Employee.query().order(+Employee.rank)
Employee.query().order(Employee.rank)
__repr__()

Return a compact unambiguous string representation of a property.

This cycles through all stored attributes and displays the ones that differ from the default values.

__set__(entity, value)

Descriptor protocol: set the value on the entity.

Parameters
  • entity (Model) – An entity to set a value on.

  • value (Any) – The value to set.

class google.cloud.ndb.blobstore.BlobNotFoundError(*args, **kwargs)[source]

Bases: object

class google.cloud.ndb.blobstore.BlobReader(*args, **kwargs)[source]

Bases: object

class google.cloud.ndb.blobstore.DataIndexOutOfRangeError(*args, **kwargs)[source]

Bases: object

class google.cloud.ndb.blobstore.Error(*args, **kwargs)[source]

Bases: object

class google.cloud.ndb.blobstore.InternalError(*args, **kwargs)[source]

Bases: object

class google.cloud.ndb.blobstore.PermissionDeniedError(*args, **kwargs)[source]

Bases: object

google.cloud.ndb.blobstore.create_upload_url(*args, **kwargs)[source]
google.cloud.ndb.blobstore.create_upload_url_async(*args, **kwargs)[source]
google.cloud.ndb.blobstore.delete(*args, **kwargs)[source]
google.cloud.ndb.blobstore.delete_async(*args, **kwargs)[source]
google.cloud.ndb.blobstore.delete_multi(*args, **kwargs)[source]
google.cloud.ndb.blobstore.delete_multi_async(*args, **kwargs)[source]
google.cloud.ndb.blobstore.fetch_data(*args, **kwargs)[source]
google.cloud.ndb.blobstore.fetch_data_async(*args, **kwargs)[source]
google.cloud.ndb.blobstore.get(*args, **kwargs)
google.cloud.ndb.blobstore.get_async(*args, **kwargs)
google.cloud.ndb.blobstore.get_multi(*args, **kwargs)
google.cloud.ndb.blobstore.get_multi_async(*args, **kwargs)
google.cloud.ndb.blobstore.parse_blob_info(*args, **kwargs)[source]