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.BlobKey(blob_key)[source]¶ Bases:
objectKey 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
bytesobject. 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
BadValueError – If the
blob_keyexceeds 1500 bytes.BadValueError – If the
blob_keyis notNoneor abytesinstance.
-
class
google.cloud.ndb.blobstore.BlobKeyProperty(name=None, indexed=None, repeated=None, required=None, default=None, choices=None, validator=None, verbose_name=None, write_empty_list=None)[source]¶ Bases:
google.cloud.ndb.model.PropertyA property containing
BlobKeyvalues.-
_validate(value)[source]¶ Validate a
valuebefore setting it.- Parameters
value (BlobKey) – The value to check.
- Raises
BadValueError – If
valueis not aBlobKey.
-
IN(value)¶ For the
incomparison operator.The
inoperator 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 asIN();_IN()is provided for the case that aStructuredPropertyrefers to a model that has a property namedIN.- 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.
If
valueis empty, this will return aFalseNodeIf
len(value) == 1, this will return aFilterNodeOtherwise, this will return a
DisjunctionNode
- Return type
Union[DisjunctionNode, FilterNode, FalseNode]
- Raises
BadFilterError – If the current property is not indexed.
BadArgumentError – If
valueis not a basic container (list,tuple,setorfrozenset).
-
__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.
-
__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.
-
-
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)¶