ReferenceSPQL

Blobs & I/O

Work with URI-backed byte payloads, blob metadata, and archive ingestion.

Scalar Functions

FunctionSummary
spql.blob.blobConstruct a spql.Blob value.
spql.blob.bytesReturn a blob's inline bytes.
spql.blob.digestReturn a blob's multihash digest.
spql.blob.etagReturn the entity tag a read of the blob must match.
spql.blob.externalConstruct a URI-backed blob without reading bytes.
spql.blob.inlineConstruct an inline blob from binary bytes.
spql.blob.mime_typeReturn a blob's MIME type.
spql.blob.offsetReturn a blob's byte offset inside the referenced object.
spql.blob.sizeReturn a blob's byte size.
spql.blob.uriReturn a blob's URI: a Spiral address or a direct provider URI.
spql.blob.versionReturn the provider object version a read of the blob must return.
spql.blob.with_mime_typeReturn a blob with its MIME type replaced without reading payload bytes.
spql.io.fetchFetch a blob's payload into an inline blob.
spql.io.read_bytesRead a blob's payload bytes.
spql.io.statReturn a blob's object metadata without reading payload bytes.

spql.blob.blob

Construct a spql.Blob value.

  • Kind: scalar function
  • Volatility: immutable
spql.blob.blob(bytes?, uri?, offset?, size?, mime_type?, version?, etag?, digest?) -> spql.Blob?

Parameters

NameRequiredTypeDescription
bytesnobinary?Inline payload bytes.
urinoutf8?spiral://<resource-id>/<key>, or a direct provider URI.
offsetnou64?Byte offset of the payload inside the referenced object; null is 0.
sizenou64?Payload length in bytes; null means to the end of the object.
mime_typenoutf8?Optional media type.
versionnoutf8?Provider object version a read must return.
etagnoutf8?Entity tag a read must match.
digestnobinary?Multihash of the payload bytes.

spql.blob.bytes

Return a blob's inline bytes.

  • Kind: scalar function
  • Volatility: immutable
spql.blob.bytes(blob) -> binary?

Parameters

NameRequiredTypeDescription
blobyesspql.BlobBlob to inspect without reading its payload.

spql.blob.digest

Return a blob's multihash digest.

  • Kind: scalar function
  • Volatility: immutable
spql.blob.digest(blob) -> binary?

Parameters

NameRequiredTypeDescription
blobyesspql.BlobBlob to inspect without reading its payload.

spql.blob.etag

Return the entity tag a read of the blob must match.

  • Kind: scalar function
  • Volatility: immutable
spql.blob.etag(blob) -> utf8?

Parameters

NameRequiredTypeDescription
blobyesspql.BlobBlob to inspect without reading its payload.

spql.blob.external

Construct a URI-backed blob without reading bytes.

  • Kind: scalar function
  • Volatility: immutable
spql.blob.external(uri, offset?, size?, mime_type?, version?, etag?, digest?) -> spql.Blob?

The URI is a Spiral address (spiral://<resource-id>/<key>) or a direct provider URI. Written into a table, the blob stays a reference to it; to store a copy, write spql.io.fetch(blob) instead. version and etag pin the object a read must return. Null URI with no metadata returns null; metadata without a URI is an error. The digest must be a supported BLAKE3-256 or SHA2-256 multihash. URI schemes are normalized without changing provider paths.

Parameters

NameRequiredTypeDescription
uriyesutf8?URI of the object containing the payload.
offsetnou64?Byte offset of the payload within the object; omitted means zero.
sizenou64?Size of the payload in bytes, when known.
mime_typenoutf8?MIME type of the payload, when known.
versionnoutf8?Provider object version required when reading the payload.
etagnoutf8?Entity tag required when reading the payload.
digestnobinary?Multihash digest used to verify the payload.

spql.blob.inline

Construct an inline blob from binary bytes.

  • Kind: scalar function
  • Volatility: immutable
spql.blob.inline(bytes, size?, mime_type?, digest?) -> spql.Blob?

Null bytes produce a null blob; empty bytes produce a valid zero-length blob. The payload buffer is reused without I/O. A supplied digest is checked for a supported multihash format without hashing the payload.

Parameters

NameRequiredTypeDescription
bytesyesbinary?Inline payload bytes; null produces a null blob.
sizenou64?Payload length in bytes. Omit or pass null to infer it; a supplied length must match.
mime_typenoutf8?Optional payload MIME type.
digestnobinary?Optional BLAKE3-256 or SHA2-256 multihash digest.

Returns

A blob containing the supplied bytes and metadata.

spql.blob.mime_type

Return a blob's MIME type.

  • Kind: scalar function
  • Volatility: immutable
spql.blob.mime_type(blob) -> utf8?

Parameters

NameRequiredTypeDescription
blobyesspql.BlobBlob to inspect without reading its payload.

spql.blob.offset

Return a blob's byte offset inside the referenced object.

  • Kind: scalar function
  • Volatility: immutable
spql.blob.offset(blob) -> u64?

Parameters

NameRequiredTypeDescription
blobyesspql.BlobBlob to inspect without reading its payload.

spql.blob.size

Return a blob's byte size.

  • Kind: scalar function
  • Volatility: immutable
spql.blob.size(blob) -> u64?

Parameters

NameRequiredTypeDescription
blobyesspql.BlobBlob to inspect without reading its payload.

spql.blob.uri

Return a blob's URI: a Spiral address or a direct provider URI.

  • Kind: scalar function
  • Volatility: immutable
spql.blob.uri(blob) -> utf8?

Parameters

NameRequiredTypeDescription
blobyesspql.BlobBlob to inspect without reading its payload.

spql.blob.version

Return the provider object version a read of the blob must return.

  • Kind: scalar function
  • Volatility: immutable
spql.blob.version(blob) -> utf8?

Parameters

NameRequiredTypeDescription
blobyesspql.BlobBlob to inspect without reading its payload.

spql.blob.with_mime_type

Return a blob with its MIME type replaced without reading payload bytes.

  • Kind: scalar function
  • Volatility: immutable
spql.blob.with_mime_type(blob, mime_type) -> spql.Blob?

Null blobs remain null. A null MIME type clears the metadata. All other fields, including the payload source and object identity, are preserved.

Parameters

NameRequiredTypeDescription
blobyesspql.Blob?Blob whose MIME metadata is replaced.
mime_typeyesutf8?Replacement MIME type; null clears the field.

Returns

A blob with the replacement MIME type.

spql.io.fetch

Fetch a blob's payload into an inline blob.

  • Kind: scalar function
  • Volatility: immutable
spql.io.fetch(blob, offset?, size?, on_error?) -> spql.Blob?

This is an effectful query operation. A spiral:// address is read with the addressed resource's permission. The result holds the bytes inline, and the source's media type when the whole payload is read; spql.blob.bytes returns them as binary. Written into a table, it is stored in that table's own storage. The optional offset and size select a range within the blob's own payload. The optional on_error mode is strict by default; null or nullable returns NULL for row-level read failures. Full reads validate the blob's declared size and digest; range reads do not.

Parameters

NameRequiredTypeDescription
blobyesspql.BlobBlob whose payload to read through the execution host.
offsetnou64?Byte offset relative to the blob payload; omitted means zero.
sizenou64?Number of bytes to read; omitted means the remaining payload.
on_errornoutf8?Read error policy: strict (default), null or nullable. The latter two return null for row-level read failures.

spql.io.read_bytes

Read a blob's payload bytes.

  • Kind: scalar function
  • Volatility: immutable
  • Visibility: deprecated
spql.io.read_bytes(blob, offset?, size?, on_error?) -> binary?

This is an effectful query operation. Use it eagerly over Python values or lazily in SQL and relation expressions. A spiral:// address is read with the addressed resource's permission. The optional offset and size select a range within the blob's own payload. The optional on_error mode is strict by default; null or nullable returns NULL for row-level read failures. Full reads validate the blob's declared size and digest; range reads do not.

Parameters

NameRequiredTypeDescription
blobyesspql.BlobBlob whose payload to read through the execution host.
offsetnou64?Byte offset relative to the blob payload; omitted means zero.
sizenou64?Number of bytes to read; omitted means the remaining payload.
on_errornoutf8?Read error policy: strict (default), null or nullable. The latter two return null for row-level read failures.

spql.io.stat

Return a blob's object metadata without reading payload bytes.

  • Kind: scalar function
  • Volatility: immutable
spql.io.stat(blob) -> struct { size: u64?, snapshot_kind: utf8?, snapshot_value: utf8?, modified_unix_nanos: u64? }

Inline blobs answer from the value itself. URI-backed blobs are authorized as a payload read is and issue a storage metadata request only. The result carries the payload size, the provider snapshot identity (such as an etag or version) when one is available, and the last-modified time in Unix nanoseconds.

Parameters

NameRequiredTypeDescription
blobyesspql.BlobBlob whose payload to read through the execution host.
Found a problem? Edit this page or report an issue.

On this page