Skip to Content
Python APIspiral.expressions.blob

Blob expressions for reading and writing blob-typed values.

Blob

def Blob(value, *, mime_type=None, threshold=None, policy=None)

Coerce a value into a blob write value for blob-typed fields.

Arguments:

  • value - Bytes, URI, dict-like blob payload, or another supported blob input.
  • mime_type - Optional MIME type to persist in blob metadata.
  • threshold - Optional inline threshold override in bytes.
  • policy - Reserved for future policy objects.

inline

def inline(value, *, mime_type=None)

Build an inline blob payload (inline.bytes).

Arguments:

  • value - Bytes-like payload.
  • mime_type - Optional MIME type to persist in metadata.

external

def external(uri, *, size_bytes=None, etag=None, mime_type=None)

Build an external blob payload from a URI.

Arguments:

  • uri - External blob URI.
  • size_bytes - Optional object size metadata.
  • etag - Optional object etag metadata.
  • mime_type - Optional MIME type to persist in metadata.

write

def write(value, *, mime_type=None, path=None, threshold=None, policy=None)

Create a write value that always externalizes bytes during write execution.

Arguments:

  • value - Input blob value.
  • mime_type - Optional MIME type to persist in metadata.
  • path - Optional destination suffix/path hint for externalized blobs.
  • threshold - Optional threshold override.
  • policy - Reserved for future policy objects.

bytes

def bytes(expr: ExprLike) -> Expr

Resolve blob bytes from inline.bytes when present, otherwise from external_uri.

Arguments:

  • expr - Blob expression.

uri

def uri(expr: ExprLike) -> Expr

Return the external URI field of a blob.

Arguments:

  • expr - Blob expression.

mime_type

def mime_type(expr: ExprLike) -> Expr

Return the stored MIME type for a blob.

Arguments:

  • expr - Blob expression.

is_inline

def is_inline(expr: ExprLike) -> Expr

Return whether the blob has inline bytes.

Arguments:

  • expr - Blob expression.

is_external

def is_external(expr: ExprLike) -> Expr

Return whether the blob has an external URI.

Arguments:

  • expr - Blob expression.
Last updated on