Skip to main content

sasvi.documents

Public surface for the documents feature layer.

Re-exports the document, child-document, insight, and workspace handles along with the bulk-operation result types so callers can import them from sasvi.documents without reaching into private submodules.

Bulk document/link upsert and async-job submission helpers.

These wrap three datahub endpoints that are otherwise reachable only via the generated facade:

  • POST /documents/bulk creates or updates many documents in one synchronous call
  • POST /links/bulk creates or updates many relationship links in one synchronous call
  • POST /admin/asyncJobs submits a server-side asynchronous job

The two bulk endpoints return a 200/201 with a mixed success/error result row per input item; partial failures are surfaced as BulkOperationResult / BulkLinkOperationResult instances with a non-None .error field. Callers wanting fail-fast semantics can use raise_on_errors.

BulkOperationResult Objects​

class BulkOperationResult(RawBackedHandle)

One row from a bulk document upsert response.

A row with error set indicates a per-item failure; the rest of the row fields describe which input the failure applies to.

id​

@property
def id() -> str | None

Identifier of the document this row applies to.

entity_type​

@property
def entity_type() -> str | None

Entity type name of the document this row applies to.

operation​

@property
def operation() -> Literal["CREATE", "UPDATE"] | None

Whether the row created or updated the document (None if absent).

error​

@property
def error() -> JsonObject | None

Per-item error payload, or None when the row succeeded.

succeeded​

@property
def succeeded() -> bool

Whether this row's document upsert succeeded (no error).

BulkLinkOperationResult Objects​

class BulkLinkOperationResult(RawBackedHandle)

One row from a bulk link upsert response.

id​

@property
def id() -> str | None

Identifier of the relationship link this row applies to.

from_entity_type​

@property
def from_entity_type() -> str | None

Entity type name of the link's source document.

from_id​

@property
def from_id() -> str | None

Document identifier of the link's source object.

to_entity_type​

@property
def to_entity_type() -> str | None

Entity type name of the link's target document.

to_id​

@property
def to_id() -> str | None

Document identifier of the link's target object.

relationship_type_name​

@property
def relationship_type_name() -> str | None

Name of the relationship type for the link in this row.

operation​

@property
def operation() -> Literal["CREATE", "UPDATE"] | None

Whether the row created or updated the link (None if absent).

error​

@property
def error() -> JsonObject | None

Per-item error payload, or None when the row succeeded.

succeeded​

@property
def succeeded() -> bool

Whether this row's link upsert succeeded (no error).

bulk_upsert_documents​

def bulk_upsert_documents(
datahub_api: DatahubAPI,
documents: Iterable[Mapping[str, Any] | BaseVIEntity],
*,
masked: bool = False,
chunk_size: int | None = None) -> list[BulkOperationResult]

Bulk create/update documents through POST /documents/bulk.

A row without a top-level id is a create. A row with one is an update, and the server is strict about its shape: fieldValues must carry the document's existing audit fields back (created_at_dttm, last_updated_at_dttm, version, and the entity's primary key), so an update is a read-modify-write::

document = client.documents.get(entity_type_name="person", document_id=doc_id) values = dict(document.fields) values["last_name"] = "Updated" client.documents.bulk_upsert( [{"objectTypeName": "person", "id": doc_id, "fieldValues": values}] )

Sending only the changed fields fails per-row with DH6916 ("null" is not a valid timestamp value); putting the primary key in fieldValues without a top-level id is read as an insert and fails with DH5118.

Arguments:

  • datahub_api - Generated Data Hub API namespace.
  • documents - Items to upsert. Each may be a dict (raw VI document payload) or a BaseVIEntity instance.
  • masked - When True, sends the Content-Item-Type header indicating that items are masked-document representations.
  • chunk_size - When set (>0), split the input into sequential chunks of this many items and POST each as its own request, aggregating all result rows (including failures) across chunks. When None (default) the entire input is sent in a single request. Note that inputs are still buffered one chunk at a time and each chunk is fully materialized into one JSON body; the transport's max_response_bytes budget bounds responses, so it does not bound a chunk's in-flight request size.

Returns:

A list of BulkOperationResult rows in input order. Inspect .succeeded / .error per row to handle partial failures.

Raises:

  • DocumentOperationError - If chunk_size is set to a non-positive value.

bulk_upsert_documents_async​

async def bulk_upsert_documents_async(
datahub_api: DatahubAPI,
documents: Iterable[Mapping[str, Any] | BaseVIEntity],
*,
masked: bool = False,
chunk_size: int | None = None) -> list[BulkOperationResult]

Asynchronously bulk create/update documents through POST /documents/bulk.

Same chunking, row aggregation and failure semantics as bulk_upsert_documents, with each chunk's request awaited.

A row without a top-level id is a create. A row with one is an update, and the server is strict about its shape: fieldValues must carry the document's existing audit fields back (created_at_dttm, last_updated_at_dttm, version, and the entity's primary key), so an update is a read-modify-write::

document = await client.documents.get_async( entity_type_name="person", document_id=doc_id ) values = dict(document.fields) values["last_name"] = "Updated" await client.documents.bulk_upsert_async( [{"objectTypeName": "person", "id": doc_id, "fieldValues": values}] )

Sending only the changed fields fails per-row with DH6916 ("null" is not a valid timestamp value); putting the primary key in fieldValues without a top-level id is read as an insert and fails with DH5118.

Arguments:

  • datahub_api - Generated Data Hub API namespace.
  • documents - Items to upsert. Each may be a dict (raw VI document payload) or a BaseVIEntity instance.
  • masked - When True, sends the Content-Item-Type header indicating that items are masked-document representations.
  • chunk_size - When set (>0), split the input into sequential chunks of this many items and POST each as its own request, aggregating all result rows (including failures) across chunks. When None (default) the entire input is sent in a single request. Note that inputs are still buffered one chunk at a time and each chunk is fully materialized into one JSON body; the transport's max_response_bytes budget bounds responses, so it does not bound a chunk's in-flight request size.

Returns:

A list of BulkOperationResult rows in input order. Inspect .succeeded / .error per row to handle partial failures.

Raises:

  • DocumentOperationError - If chunk_size is set to a non-positive value.
  • BulkRequestError - If a request fails or answers with the wrong number of rows; the rows confirmed before it are attached as completed.
def bulk_upsert_links(
datahub_api: DatahubAPI,
links: Iterable[Mapping[str, Any]],
*,
chunk_size: int | None = None) -> list[BulkLinkOperationResult]

Bulk create/update relationship links through POST /links/bulk.

The links are stored straight away but may not reach the search graph until the relationship types are reindexed, so search and the network view can show the records unlinked. Callers should run a scoped index afterwards.

Arguments:

  • datahub_api - Generated Data Hub API namespace.
  • links - Items to upsert. Each is a relationship link payload in the Data Hub DocumentLink shape: relationshipTypeName, fromObjectTypeName, fromObjectId, toObjectTypeName and toObjectId (plus optional fieldValues); an item carrying the link id updates that link. "@type": "DocumentLink" is added when absent.
  • chunk_size - When set (>0), split the input into sequential chunks of this many items and POST each as its own request, aggregating all result rows (including failures) across chunks. When None (default) the entire input is sent in a single request. Note that inputs are still buffered one chunk at a time and each chunk is fully materialized into one JSON body; the transport's max_response_bytes budget bounds responses, so it does not bound a chunk's in-flight request size.

Returns:

A list of BulkLinkOperationResult rows in input order.

Raises:

  • DocumentOperationError - If chunk_size is set to a non-positive value.
  • BulkRequestError - If an item is not a mapping, or a create item (one without id) lacks a field the service requires; nothing from that item's chunk is sent.
async def bulk_upsert_links_async(
datahub_api: DatahubAPI,
links: Iterable[Mapping[str, Any]],
*,
chunk_size: int | None = None) -> list[BulkLinkOperationResult]

Asynchronously bulk create/update relationship links through POST /links/bulk.

Same chunking, row aggregation and failure semantics as bulk_upsert_links, with each chunk's request awaited.

The links are stored straight away but may not reach the search graph until the relationship types are reindexed, so search and the network view can show the records unlinked. Callers should run a scoped index afterwards.

Arguments:

  • datahub_api - Generated Data Hub API namespace.
  • links - Items to upsert. Each is a relationship link payload in the Data Hub DocumentLink shape: relationshipTypeName, fromObjectTypeName, fromObjectId, toObjectTypeName and toObjectId (plus optional fieldValues); an item carrying the link id updates that link. "@type": "DocumentLink" is added when absent.
  • chunk_size - When set (>0), split the input into sequential chunks of this many items and POST each as its own request, aggregating all result rows (including failures) across chunks. When None (default) the entire input is sent in a single request. Note that inputs are still buffered one chunk at a time and each chunk is fully materialized into one JSON body; the transport's max_response_bytes budget bounds responses, so it does not bound a chunk's in-flight request size.

Returns:

A list of BulkLinkOperationResult rows in input order.

Raises:

  • DocumentOperationError - If chunk_size is set to a non-positive value.
  • BulkRequestError - If an item is not a mapping, or a create item (one without id) lacks a field the service requires; nothing from that item's chunk is sent.

submit_async_job​

def submit_async_job(datahub_api: DatahubAPI,
*,
parameters: Mapping[str, Any],
tasks: Sequence[Mapping[str, Any]] | None = None,
name: str | None = None,
description: str | None = None,
tags: Sequence[str] | None = None,
version: int = 1) -> JobHandle

Submit an async job through POST /admin/asyncJobs.

A task is a raw task object as the Data Hub definition documents it, for example {"version": 1, "parameters": {"type": "LOAD_DOCUMENT", "name": "<entity>"}}.

Arguments:

  • datahub_api - Generated Data Hub API namespace.
  • parameters - Parameters required for the job; passed through as the parameters object on the job payload.
  • tasks - Optional per-task payloads, each a raw task object. A job that names no task indexes everything.
  • name - Optional human-readable name.
  • description - Optional description.
  • tags - Optional tags used for later lookup.
  • version - Schema version sent on the job payload. Defaults to 1.

Returns:

A JobHandle exposing the fields the server returned on submission.

Raises:

  • DocumentOperationError - When the server answers without a payload.

submit_async_job_async​

async def submit_async_job_async(datahub_api: DatahubAPI,
*,
parameters: Mapping[str, Any],
tasks: Sequence[Mapping[str, Any]]
| None = None,
name: str | None = None,
description: str | None = None,
tags: Sequence[str] | None = None,
version: int = 1) -> JobHandle

Asynchronously submit an async job through POST /admin/asyncJobs.

Same payload and answer handling as submit_async_job.

A task is a raw task object as the Data Hub definition documents it, for example {"version": 1, "parameters": {"type": "LOAD_DOCUMENT", "name": "<entity>"}}.

Arguments:

  • datahub_api - Generated Data Hub API namespace.
  • parameters - Parameters required for the job; passed through as the parameters object on the job payload.
  • tasks - Optional per-task payloads, each a raw task object. A job that names no task indexes everything.
  • name - Optional human-readable name.
  • description - Optional description.
  • tags - Optional tags used for later lookup.
  • version - Schema version sent on the job payload. Defaults to 1.

Returns:

A JobHandle exposing the fields the server returned on submission.

Raises:

  • DocumentOperationError - When the server answers without a payload.

raise_on_errors​

def raise_on_errors(
results: Sequence[BulkOperationResult | BulkLinkOperationResult]
) -> None

Raise BulkOperationError if any row in results failed.

Arguments:

  • results - Output of bulk_upsert_documents or bulk_upsert_links.

Raises:

  • BulkOperationError - With a count of failures and the first error payload in the message, when at least one row has .error is not None. Every failed row is available on the exception's failures attribute. The class subclasses DocumentOperationError, so existing handlers keep working.

Child documents: the bound ChildDocument handle and the collections that reach it.

Document.children is a ChildrenManager. Its of(child_type) returns the ChildDocumentCollection that lists, fetches, creates and deletes the children of one child type. A child is stored inside its parent document, so creating or deleting one is a locked write of the parent.

ChildDocument Objects​

class ChildDocument(RawBackedHandle)

Bound child document exposed through a parent document relationship.

Arguments:

  • runtime - Child-document runtime that owns the child snapshot.

history​

images​

parent_type​

@property
def parent_type() -> str

Entity type name of the parent document.

parent_id​

@property
def parent_id() -> str

Document identifier of the parent document.

child_type​

@property
def child_type() -> str

Entity type name of this child document.

child_id​

@property
def child_id() -> str

Document identifier of this child document.

fields​

@property
def fields() -> dict[str, object]

Mapping of this child document's field names to their values.

raw​

@property
def raw() -> PlainDocument

The underlying generated Document snapshot for the child.

fetch_entity_type_mode​

def fetch_entity_type_mode() -> str | None

Return the storage mode of the child's entity type.

Sends a request when nothing is cached.

Returns:

"MANAGED" or "SOURCE", from the cache when the entity type was loaded before and from one GET otherwise. None when the entity type cannot be found.

Raises:

  • DocumentOperationError - If the entity-type read fails; an unknown type returns None.

fetch_entity_type_mode_async​

async def fetch_entity_type_mode_async() -> str | None

Asynchronously return the storage mode of the child's entity type.

See fetch_entity_type_mode.

Returns:

"MANAGED" or "SOURCE", from the cache when the entity type was loaded before and from one GET otherwise. None when the entity type cannot be found.

Raises:

  • DocumentOperationError - If the entity-type read fails; an unknown type returns None.

refresh​

def refresh() -> ChildDocument

Refresh the child-document snapshot from the service.

Raises:

  • DocumentNotFoundError - If the parent document no longer exists.
  • DocumentOperationError - If the Data Hub refuses the read.

refresh_async​

async def refresh_async() -> ChildDocument

Asynchronously refresh the child-document snapshot.

Returns:

This child document, holding the refreshed snapshot.

Raises:

  • DocumentNotFoundError - If the parent document no longer exists.
  • DocumentOperationError - If the Data Hub refuses the read.

get_field​

def get_field(name: str, default: object | None = None) -> object | None

Return one child field value, or default when the child has no such field.

Arguments:

  • name - VI field name.
  • default - Value to return when the field is absent.

Returns:

The field value from the current snapshot, or default.

require_field​

def require_field(name: str) -> object

Return one child field value or raise when it is absent.

Arguments:

  • name - Field name.

Returns:

The field's value.

Raises:

  • KeyError - If the child document has no field of that name.

delete​

def delete() -> None

Delete the child document.

Raises:

  • DocumentNotFoundError - If the parent document or the child no longer exists.
  • DocumentConflictError - If the parent is locked by another user or changed since it was read (412).
  • DocumentOperationError - If the child or parent entity type is a SOURCE type or the Data Hub refuses the write.

delete_async​

async def delete_async() -> None

Asynchronously delete the child document.

Same lock window and precondition as delete.

Raises:

  • DocumentNotFoundError - If the parent document or the child no longer exists.
  • DocumentConflictError - If the parent is locked by another user or changed since it was read (412).
  • DocumentOperationError - If the child or parent entity type is a SOURCE type or the Data Hub refuses the write.

update​

def update(mapping: Mapping[str, Any]) -> ChildDocument

Update child-document field values from a mapping.

Arguments:

  • mapping - Child field names mapped to replacement values.

Returns:

The updated child document.

Raises:

  • DocumentNotFoundError - If the parent document or the child no longer exists.
  • DocumentConflictError - If the parent is locked by another user or changed since it was read (412).
  • DocumentOperationError - If a field is unknown or not writable, the child or parent entity type is a SOURCE type, or the Data Hub refuses the write.

update_async​

async def update_async(mapping: Mapping[str, Any]) -> ChildDocument

Asynchronously update child-document field values from a mapping.

Arguments:

  • mapping - Child field names mapped to replacement values.

Returns:

The updated child document.

Raises:

  • DocumentNotFoundError - If the parent document or the child no longer exists.
  • DocumentConflictError - If the parent is locked by another user or changed since it was read (412).
  • DocumentOperationError - If a field is unknown or not writable, the child or parent entity type is a SOURCE type, or the Data Hub refuses the write.

update_fields​

def update_fields(**changes: Any) -> ChildDocument

Update child-document field values from keyword arguments.

Arguments:

  • **changes - Child field names mapped to replacement values.

Returns:

The updated child document.

Raises:

  • DocumentNotFoundError - If the parent document or the child no longer exists.
  • DocumentConflictError - If the parent is locked by another user or changed since it was read (412).
  • DocumentOperationError - If a field is unknown or not writable, the child or parent entity type is a SOURCE type, or the Data Hub refuses the write.

update_fields_async​

async def update_fields_async(**changes: Any) -> ChildDocument

Asynchronously update child-document field values from kwargs.

Arguments:

  • **changes - Child field names mapped to replacement values.

Returns:

The updated child document.

Raises:

  • DocumentNotFoundError - If the parent document or the child no longer exists.
  • DocumentConflictError - If the parent is locked by another user or changed since it was read (412).
  • DocumentOperationError - If a field is unknown or not writable, the child or parent entity type is a SOURCE type, or the Data Hub refuses the write.

set_field​

def set_field(name: str, value: Any) -> ChildDocument

Update one child-document field explicitly.

Arguments:

  • name - Field name to update.
  • value - Replacement value.

Returns:

The updated child document.

Raises:

  • DocumentNotFoundError - If the parent document or the child no longer exists.
  • DocumentConflictError - If the parent is locked by another user or changed since it was read (412).
  • DocumentOperationError - If a field is unknown or not writable, the child or parent entity type is a SOURCE type, or the Data Hub refuses the write.

set_field_async​

async def set_field_async(name: str, value: Any) -> ChildDocument

Asynchronously update one child-document field explicitly.

Arguments:

  • name - Field name to update.
  • value - Replacement value.

Returns:

The updated child document.

Raises:

  • DocumentNotFoundError - If the parent document or the child no longer exists.
  • DocumentConflictError - If the parent is locked by another user or changed since it was read (412).
  • DocumentOperationError - If a field is unknown or not writable, the child or parent entity type is a SOURCE type, or the Data Hub refuses the write.

clear_fields​

def clear_fields(*names: str) -> ChildDocument

Clear one or more child-document fields explicitly.

Arguments:

  • *names - Child field names to set to null. No names sends no request.

Returns:

The updated child document.

Raises:

  • DocumentNotFoundError - If the parent document or the child no longer exists.
  • DocumentConflictError - If the parent is locked by another user or changed since it was read (412).
  • DocumentOperationError - If a field is unknown or not writable, the child or parent entity type is a SOURCE type, or the Data Hub refuses the write.

clear_fields_async​

async def clear_fields_async(*names: str) -> ChildDocument

Asynchronously clear one or more child-document fields explicitly.

Arguments:

  • *names - Child field names to set to null. No names sends no request.

Returns:

The updated child document.

Raises:

  • DocumentNotFoundError - If the parent document or the child no longer exists.
  • DocumentConflictError - If the parent is locked by another user or changed since it was read (412).
  • DocumentOperationError - If a field is unknown or not writable, the child or parent entity type is a SOURCE type, or the Data Hub refuses the write.

raw_dict​

def raw_dict() -> JsonObject

Return the generated child-document payload as a deep-copied dictionary.

to_dict​

def to_dict() -> JsonObject

Return a compact JSON-serializable snapshot of the child-document wrapper.

ChildDocumentCollection Objects​

class ChildDocumentCollection()

Manager for one child-relationship type under a parent document.

Arguments:

  • runtime - Parent document runtime used for child operations.
  • child_type_name - VI child entity type name represented by the collection.

list​

def list(*, start: int = 0, limit: int = 40) -> builtins.list[ChildDocument]

List child documents of this relationship type.

Arguments:

  • start - Zero-based page offset.
  • limit - Maximum number of child documents to return.

Returns:

Bound child-document wrappers.

Raises:

  • DocumentNotFoundError - If the parent document does not exist.
  • DocumentOperationError - If the Data Hub refuses the read.

list_async​

async def list_async(*,
start: int = 0,
limit: int = 40) -> builtins.list[ChildDocument]

Asynchronously list child documents of this relationship type.

Arguments:

  • start - Zero-based page offset.
  • limit - Maximum number of child documents to return.

Returns:

Bound child-document wrappers.

Raises:

  • DocumentNotFoundError - If the parent document does not exist.
  • DocumentOperationError - If the Data Hub refuses the read.

get​

def get(*, child_id: str) -> ChildDocument | None

Fetch one child document by child id.

Arguments:

  • child_id - Child document identifier.

Returns:

The bound child document, or None when it does not exist.

Raises:

  • DocumentNotFoundError - If the parent document does not exist.
  • DocumentOperationError - If the Data Hub refuses the read.

get_async​

async def get_async(*, child_id: str) -> ChildDocument | None

Asynchronously fetch one child document by child id.

Arguments:

  • child_id - Child document identifier.

Returns:

The bound child document, or None when it does not exist.

Raises:

  • DocumentNotFoundError - If the parent document does not exist.
  • DocumentOperationError - If the Data Hub refuses the read.

create​

def create(*,
field_values: dict[str, Any] | None = None,
images: Sequence[ChildImageCreateInput | Mapping[str, Any]]
| None = None,
**extra: Any) -> ChildDocument

Create a new child document under the current parent document.

Arguments:

  • field_values - Initial child field values keyed by VI field name.
  • images - Optional image attachments to create with the child in one operation.
  • **extra - Additional raw child payload properties forwarded to Data Hub.

Returns:

The created bound child document.

Raises:

  • DocumentNotFoundError - If the parent document or the child entity type does not exist.
  • DocumentConflictError - If the parent is locked by another user or changed since it was read (412).
  • DocumentOperationError - If the child or parent entity type is a SOURCE type, a field is unknown or not writable, a value does not fit its field, or the Data Hub refuses the write.
  • MalformedResponseError - If the parent write succeeded but its answer does not identify the new child (a missing, null or empty id, or several new children because another writer added one). The child was probably created; refetch the parent's children before creating it again.

create_async​

async def create_async(*,
field_values: dict[str, Any] | None = None,
images: Sequence[ChildImageCreateInput
| Mapping[str, Any]] | None = None,
**extra: Any) -> ChildDocument

Asynchronously create a new child document under the current parent document.

Arguments:

  • field_values - Initial child field values keyed by VI field name.
  • images - Optional image attachments to create with the child in one operation.
  • **extra - Additional raw child payload properties forwarded to Data Hub.

Returns:

The created bound child document.

Raises:

  • DocumentNotFoundError - If the parent document or the child entity type does not exist.
  • DocumentConflictError - If the parent is locked by another user or changed since it was read (412).
  • DocumentOperationError - If the child or parent entity type is a SOURCE type, a field is unknown or not writable, a value does not fit its field, or the Data Hub refuses the write.
  • MalformedResponseError - If the parent write succeeded but its answer does not identify the new child (a missing, null or empty id, or several new children because another writer added one). The child was probably created; refetch the parent's children before creating it again.

delete​

def delete(*, child_id: str) -> None

Delete one child document by child id.

Arguments:

  • child_id - Child document identifier.

Raises:

  • DocumentNotFoundError - If the parent document or the child does not exist.
  • DocumentConflictError - If the parent is locked by another user or changed since it was read (412).
  • DocumentOperationError - If the child or parent entity type is a SOURCE type or the Data Hub refuses the write.

delete_async​

async def delete_async(*, child_id: str) -> None

Asynchronously delete one child document by child id.

Arguments:

  • child_id - Child document identifier.

Raises:

  • DocumentNotFoundError - If the parent document or the child does not exist.
  • DocumentConflictError - If the parent is locked by another user or changed since it was read (412).
  • DocumentOperationError - If the child or parent entity type is a SOURCE type or the Data Hub refuses the write.

ChildrenManager Objects​

class ChildrenManager()

Discovery and lookup helper for child-document relationships.

Arguments:

  • runtime - Parent document runtime used for child discovery.

types​

def types() -> builtins.list[str]

List child entity types defined for the current parent entity type.

Raises:

  • DocumentOperationError - If the entity-type listing fails.

types_async​

async def types_async() -> builtins.list[str]

Asynchronously list child entity types defined for the current parent entity type.

Returns:

The child entity type names, sorted.

Raises:

  • DocumentOperationError - If the entity-type listing fails.

list_all​

def list_all(
*,
batch_size: int = 40,
max_items: int | None = None
) -> dict[str, builtins.list[ChildDocument]]

List every child document of every known child type, paging until exhausted.

Arguments:

  • batch_size - Page size per request; must be greater than 0.
  • max_items - Optional ceiling on the number of children returned per child type.

Returns:

Mapping of child type name to every bound child document of that type.

Raises:

  • DocumentOperationError - If batch_size is not greater than 0 or the Data Hub rejects a read.

list_all_async​

async def list_all_async(
*,
batch_size: int = 40,
max_items: int | None = None
) -> dict[str, builtins.list[ChildDocument]]

Asynchronously list every child document of every known child type.

Pages each child type until it is exhausted, one type after another.

Arguments:

  • batch_size - Page size per request; must be greater than 0.
  • max_items - Optional ceiling on the number of children returned per child type.

Returns:

Mapping of child type name to every bound child document of that type.

Raises:

  • DocumentOperationError - If batch_size is not greater than 0 or the Data Hub rejects a read.

of​

def of(child_type_name: str) -> ChildDocumentCollection

Return a collection helper for one child entity type name.

Arguments:

  • child_type_name - Child entity type name.

Returns:

A child-document collection helper.

Creating documents and child documents: input checks, the request, its answer.

DocumentCollection.create and ChildDocumentCollection.create share the rules here. Which create inputs are accepted and how they combine; a SOURCE entity type is refused before anything is sent, from the one entity-type read the create makes; and a create's answer must identify the new record. A success answer that does not raises MalformedResponseError, because the record was probably created and a resend would duplicate it.

create_document​

def create_document(datahub_api: DatahubAPI, *, entity_type_name: str,
field_values: dict[str, Any] | None,
extra: Mapping[str, Any]) -> EnrichedDocument

Create a managed document through POST /documents.

Arguments:

  • datahub_api - Generated Data Hub namespace.
  • entity_type_name - Visual Investigator entity type name.
  • field_values - Initial field values keyed by VI field name.
  • extra - Additional raw payload properties forwarded to Data Hub.

Returns:

The created document's snapshot.

Raises:

  • DocumentRuntimeError - If the inputs conflict, the entity type is not mutable, or the create request fails.
  • MalformedResponseError - If the server answered 201 with a body the SDK cannot read, or one that names no document id (missing, null or empty). The document was probably created; status_code carries the 201.

create_document_async​

async def create_document_async(datahub_api: DatahubAPI, *,
entity_type_name: str,
field_values: dict[str, Any] | None,
extra: Mapping[str, Any]) -> EnrichedDocument

Create a managed document through POST /documents without blocking the event loop.

Arguments:

  • datahub_api - Generated Data Hub namespace.
  • entity_type_name - Visual Investigator entity type name.
  • field_values - Initial field values keyed by VI field name.
  • extra - Additional raw payload properties forwarded to Data Hub.

Returns:

The created document's snapshot.

Raises:

  • DocumentRuntimeError - If the inputs conflict, the entity type is not mutable, or the create request fails.
  • MalformedResponseError - If the server answered 201 with a body the SDK cannot read, or one that names no document id (missing, null or empty). The document was probably created; status_code carries the 201.

The bound Document handle and the DocumentCollection that binds it.

A Document carries a live snapshot plus the per-resource managers from sasvi.documents._managers. Field values are read through fields or get_field(), never as attributes, and mutations go through explicit, autosave-off methods. DocumentCollection fetches, lists and creates documents and binds each one to a handle.

The two classes reference each other. The collection binds Document handles, and a handle reaches its workspace nodes and workflow tasks through the collection that bound it, or through one it builds when it was bound without one. They share this module so that the reference is not an import cycle. Child documents, the create rules and the read request builders live in their own modules.

Document Objects​

class Document(RawBackedHandle)

Bound Data Hub document with convenience managers for related resources.

Arguments:

  • runtime - Internal runtime that owns the document snapshot and mutation logic.

comments​

attachments​

images​

insights​

workspaces​

relationships​

conditions​

history​

children​

document_type​

@property
def document_type() -> str

VI entity type name (e.g. "alerts", "persons").

document_id​

@property
def document_id() -> str

VI document identifier within the entity type.

fields​

@property
def fields() -> dict[str, object]

Mapping of this document's field names to their current values.

raw​

@property
def raw() -> EnrichedDocument

The underlying generated EnrichedDocument snapshot.

label​

@property
def label() -> str | None

Human-readable display label for the document, if resolvable.

fetch_entity_type_mode​

def fetch_entity_type_mode() -> str | None

Return the storage mode of the document's entity type.

Sends a request when nothing is cached.

Returns:

"MANAGED" or "SOURCE", from the cache when the entity type was loaded before and from one GET otherwise. None when the entity type cannot be found.

Raises:

  • DocumentOperationError - If the entity-type read fails; an unknown type returns None.

fetch_entity_type_mode_async​

async def fetch_entity_type_mode_async() -> str | None

Asynchronously return the storage mode of the document's entity type.

See fetch_entity_type_mode.

Returns:

"MANAGED" or "SOURCE", from the cache when the entity type was loaded before and from one GET otherwise. None when the entity type cannot be found.

Raises:

  • DocumentOperationError - If the entity-type read fails; an unknown type returns None.

location_items​

def location_items() -> builtins.list[EntityEventItem]

Return configured location event items for this document's type.

Returns:

The location event items, empty when the entity type is unknown or has none.

Raises:

  • DocumentOperationError - When the document's collection was built without entity_event_metadata. SVIClient supplies it.

location_items_async​

async def location_items_async() -> builtins.list[EntityEventItem]

Asynchronously return configured location event items for this document's type.

Returns:

The location event items, empty when the entity type is unknown or has none.

Raises:

  • DocumentOperationError - When the document's collection was built without entity_event_metadata. SVIClient supplies it.

time_items​

def time_items() -> builtins.list[EntityEventItem]

Return configured time event items for this document's type.

Returns:

The time event items, empty when the entity type is unknown or has none.

Raises:

  • DocumentOperationError - When the document's collection was built without entity_event_metadata. SVIClient supplies it.

time_items_async​

async def time_items_async() -> builtins.list[EntityEventItem]

Asynchronously return configured time event items for this document's type.

Returns:

The time event items, empty when the entity type is unknown or has none.

Raises:

  • DocumentOperationError - When the document's collection was built without entity_event_metadata. SVIClient supplies it.

time_location_items​

def time_location_items() -> builtins.list[EntityEventItem]

Return configured time-location event items for this document's type.

Returns:

The time-location event items, empty when the entity type is unknown or has none.

Raises:

  • DocumentOperationError - When the document's collection was built without entity_event_metadata. SVIClient supplies it.

time_location_items_async​

async def time_location_items_async() -> builtins.list[EntityEventItem]

Asynchronously return configured time-location event items for this document's type.

Returns:

The time-location event items, empty when the entity type is unknown or has none.

Raises:

  • DocumentOperationError - When the document's collection was built without entity_event_metadata. SVIClient supplies it.

checkout_state​

def checkout_state() -> JsonObject

Fetch the current-user checkout state for this document.

to_dict does not carry these fields, so serializing a document stays local and asking the service about the lock is an explicit call.

Returns:

is_checked_out_by_me and checkout_status for this document.

Raises:

  • DocumentOperationError - If the lock query fails for a reason other than a missing lock, which reads as not checked out.

checkout_state_async​

async def checkout_state_async() -> JsonObject

Asynchronously fetch the current-user checkout state.

Returns:

is_checked_out_by_me and checkout_status for this document.

Raises:

  • DocumentOperationError - If the lock query fails for a reason other than a missing lock, which reads as not checked out.

release_lock​

def release_lock(*, force: bool = False) -> bool

Release a lock that an interrupted write left on this document.

A killed process, a second Ctrl-C, or an event loop torn down straight after a cancellation can leave the document locked. Without force the service is first asked whether the calling user holds the lock, and nothing is released when it says no. With force the release is sent without that check.

Arguments:

  • force - Send the release without checking the lock first.

Returns:

True when a release was sent and accepted, False when the calling user holds no lock: the check said so and nothing was sent, or the release itself answered 404.

Raises:

  • SVIError - When the service refuses the release or the request fails.

release_lock_async​

async def release_lock_async(*, force: bool = False) -> bool

Asynchronously release a lock that an interrupted write left behind.

See release_lock.

Arguments:

  • force - Send the release without checking the lock first.

Returns:

True when a release was sent and accepted, False when the calling user holds no lock: the check said so and nothing was sent, or the release itself answered 404.

Raises:

  • SVIError - When the service refuses the release or the request fails.

refresh​

def refresh() -> Document

Refresh the document snapshot from the service.

Raises:

  • DocumentNotFoundError - If the document no longer exists.
  • DocumentOperationError - If the Data Hub refuses the read.

refresh_async​

async def refresh_async() -> Document

Asynchronously refresh the document snapshot from the service.

Raises:

  • DocumentNotFoundError - If the document no longer exists.
  • DocumentOperationError - If the Data Hub refuses the read.

get_field​

def get_field(name: str, default: object | None = None) -> object | None

Return one field value, or default when the document has no such field.

Arguments:

  • name - VI field name.
  • default - Value to return when the field is absent.

Returns:

The field value from the current snapshot, or default.

require_field​

def require_field(name: str) -> object

Return one field value or raise when it is absent.

Arguments:

  • name - Field name.

Returns:

The field's value.

Raises:

  • KeyError - If the document has no field of that name.

delete​

def delete() -> None

Delete the document.

Raises:

  • DocumentNotFoundError - If the document no longer exists.
  • DocumentConflictError - If the document is locked by another user.
  • DocumentOperationError - If the entity type is a SOURCE type or the Data Hub refuses the delete.

delete_async​

async def delete_async() -> None

Asynchronously delete the document.

Raises:

  • DocumentNotFoundError - If the document no longer exists.
  • DocumentConflictError - If the document is locked by another user.
  • DocumentOperationError - If the entity type is a SOURCE type or the Data Hub refuses the delete.

current_tasks​

def current_tasks(
*,
include_only_workable_tasks: bool = False
) -> builtins.list[WorkflowTask]

List every workflow task whose target is the current document.

Pages through the service until it is exhausted, so a document with more tasks than fit on one page is listed in full.

Arguments:

  • include_only_workable_tasks - Whether to omit non-workable tasks.

Returns:

Bound workflow task wrappers for this document.

Raises:

  • DocumentOperationError - If the document was bound without workflows support.
  • WorkflowOperationError - If the workflow service refuses the task query.
  • IncompleteListingError - When the listing stops advancing or hits the page cap before the service is exhausted.

current_tasks_async​

async def current_tasks_async(
*,
include_only_workable_tasks: bool = False
) -> builtins.list[WorkflowTask]

Asynchronously list every workflow task whose target is the current document.

See current_tasks: the listing pages until the service is exhausted.

Arguments:

  • include_only_workable_tasks - Whether to omit non-workable tasks.

Returns:

Bound workflow task wrappers for this document.

Raises:

  • DocumentOperationError - If the document was bound without workflows support.
  • WorkflowOperationError - If the workflow service refuses the task query.
  • IncompleteListingError - When the listing stops advancing or hits the page cap before the service is exhausted.

update​

def update(mapping: Mapping[str, Any]) -> Document

Update document fields from a mapping.

Arguments:

  • mapping - Field names mapped to replacement values.

Returns:

The updated bound document.

Raises:

  • DocumentNotFoundError - If the document no longer exists.
  • DocumentConflictError - If the document is locked by another user or changed since it was read (412).
  • DocumentOperationError - If a field is unknown or not writable, the entity type is a SOURCE type, or the Data Hub refuses the write.

update_async​

async def update_async(mapping: Mapping[str, Any]) -> Document

Asynchronously update document fields from a mapping.

Arguments:

  • mapping - Field names mapped to replacement values.

Returns:

The updated bound document.

Raises:

  • DocumentNotFoundError - If the document no longer exists.
  • DocumentConflictError - If the document is locked by another user or changed since it was read (412).
  • DocumentOperationError - If a field is unknown or not writable, the entity type is a SOURCE type, or the Data Hub refuses the write.

prepare_update​

def prepare_update(mapping: Mapping[str, Any]) -> Sequence[JsonPatchOperation]

Validate a field update and build its patch, without writing anything.

Use it with apply_update when a step that cannot be undone sits between the validation and the write. update is the two in one call.

Arguments:

  • mapping - Field names mapped to replacement values.

Returns:

The patch operations for apply_update. Empty when mapping is empty.

Raises:

  • DocumentRuntimeError - When the entity type is SOURCE, a field is unknown or not writable, or the metadata cannot be resolved.

prepare_update_async​

async def prepare_update_async(
mapping: Mapping[str, Any]) -> Sequence[JsonPatchOperation]

Asynchronously validate a field update and build its patch.

Arguments:

  • mapping - Field names mapped to replacement values.

Returns:

The patch operations for apply_update_async. Empty when mapping is empty.

Raises:

  • DocumentRuntimeError - When the entity type is SOURCE, a field is unknown or not writable, or the metadata cannot be resolved.

apply_update​

def apply_update(operations: Sequence[JsonPatchOperation]) -> Document

Write the patch built by prepare_update.

Arguments:

  • operations - Patch operations from prepare_update.

Returns:

The updated bound document.

Raises:

  • DocumentOperationError - When the Data Hub rejects the write.

apply_update_async​

async def apply_update_async(
operations: Sequence[JsonPatchOperation]) -> Document

Asynchronously write the patch built by prepare_update_async.

Arguments:

  • operations - Patch operations from prepare_update_async.

Returns:

The updated bound document.

Raises:

  • DocumentOperationError - When the Data Hub rejects the write.

update_fields​

def update_fields(**changes: Any) -> Document

Update document fields from keyword arguments.

Arguments:

  • **changes - Field names mapped to replacement values.

Returns:

The updated bound document.

Raises:

  • DocumentNotFoundError - If the document no longer exists.
  • DocumentConflictError - If the document is locked by another user or changed since it was read (412).
  • DocumentOperationError - If a field is unknown or not writable, the entity type is a SOURCE type, or the Data Hub refuses the write.

update_fields_async​

async def update_fields_async(**changes: Any) -> Document

Asynchronously update document fields from keyword arguments.

Arguments:

  • **changes - Field names mapped to replacement values.

Returns:

The updated bound document.

Raises:

  • DocumentNotFoundError - If the document no longer exists.
  • DocumentConflictError - If the document is locked by another user or changed since it was read (412).
  • DocumentOperationError - If a field is unknown or not writable, the entity type is a SOURCE type, or the Data Hub refuses the write.

set_field​

def set_field(name: str, value: Any) -> Document

Update one document field explicitly.

Arguments:

  • name - Field name to update.
  • value - Replacement value.

Returns:

The updated bound document.

Raises:

  • DocumentNotFoundError - If the document no longer exists.
  • DocumentConflictError - If the document is locked by another user or changed since it was read (412).
  • DocumentOperationError - If a field is unknown or not writable, the entity type is a SOURCE type, or the Data Hub refuses the write.

set_field_async​

async def set_field_async(name: str, value: Any) -> Document

Asynchronously update one document field explicitly.

Arguments:

  • name - Field name to update.
  • value - Replacement value.

Returns:

The updated bound document.

Raises:

  • DocumentNotFoundError - If the document no longer exists.
  • DocumentConflictError - If the document is locked by another user or changed since it was read (412).
  • DocumentOperationError - If a field is unknown or not writable, the entity type is a SOURCE type, or the Data Hub refuses the write.

clear_fields​

def clear_fields(*names: str) -> Document

Clear one or more document fields explicitly.

Arguments:

  • *names - Field names to set to null. No names sends no request.

Returns:

The updated bound document.

Raises:

  • DocumentNotFoundError - If the document no longer exists.
  • DocumentConflictError - If the document is locked by another user or changed since it was read (412).
  • DocumentOperationError - If a field is unknown or not writable, the entity type is a SOURCE type, or the Data Hub refuses the write.

clear_fields_async​

async def clear_fields_async(*names: str) -> Document

Asynchronously clear one or more document fields explicitly.

Arguments:

  • *names - Field names to set to null. No names sends no request.

Returns:

The updated bound document.

Raises:

  • DocumentNotFoundError - If the document no longer exists.
  • DocumentConflictError - If the document is locked by another user or changed since it was read (412).
  • DocumentOperationError - If a field is unknown or not writable, the entity type is a SOURCE type, or the Data Hub refuses the write.

raw_dict​

def raw_dict() -> JsonObject

Return the generated document payload as a deep-copied dictionary.

to_dict​

def to_dict() -> JsonObject

Return a JSON-serializable snapshot of the state already loaded.

It issues no requests. entity_type_mode and is_external are None when the entity type has not been loaded yet, rather than a fabricated value; call checkout_state for live lock status.

Returns:

The loaded document state. Network-backed fields that have not been loaded are None.

DocumentCollection Objects​

class DocumentCollection()

Service for fetching, listing, and creating bound documents.

Arguments:

  • datahub_api - Generated Data Hub namespace used for API calls.

relationships​

get​

def get(*, entity_type_name: str, document_id: str) -> Document | None

Fetch a document by type and id.

Arguments:

  • entity_type_name - Visual Investigator entity type name.
  • document_id - Data Hub document identifier.

Returns:

A bound document, or None when it does not exist.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read, or returns a payload without an id and no id is available to bind.

get_async​

async def get_async(*, entity_type_name: str,
document_id: str) -> Document | None

Asynchronously fetch a document by type and id.

Arguments:

  • entity_type_name - Visual Investigator entity type name.
  • document_id - Data Hub document identifier.

Returns:

A bound document, or None when it does not exist.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read, or returns a payload without an id and no id is available to bind.

list​

def list(*,
entity_type_name: str,
start: int = 0,
limit: int = 40,
depth: str = "0",
filter_: str | None = None,
where: Mapping[str, str | int | float | bool] | None = None,
sort_by: str | None = None) -> builtins.list[Document]

List documents for an entity type, optionally filtered and sorted.

Without filter_, where, or sort_by this is the plain collection read. With any of them the Data Hub's filtered read is used, which accepts a reduced filter grammar: only eq, and, and or over entity field names (not column names) of type STRING, INTEGER, SMALLINT, LONG, NUMERIC, BOOLEAN, or REFERENCE_DATA (compare against the item's code). Child-document fields cannot be filtered.

Arguments:

  • entity_type_name - Visual Investigator entity type name.
  • start - Zero-based offset into the collection.
  • limit - Maximum number of documents to return.
  • depth - Data Hub depth parameter ("0" no children, "1" with).
  • filter_ - Raw filter expression in the grammar above, ANDed with where when both are given.
  • where - Field-name → value equality constraints, ANDed together.
  • sort_by - "<field>:ascending" or "<field>:descending".

Returns:

Bound documents for the requested page.

Raises:

  • ValidationError - If a where key is not a valid field name or a value is not a supported scalar.
  • DocumentOperationError - If the Data Hub rejects the read.

list_async​

async def list_async(*,
entity_type_name: str,
start: int = 0,
limit: int = 40,
depth: str = "0",
filter_: str | None = None,
where: Mapping[str, str | int | float | bool]
| None = None,
sort_by: str | None = None) -> builtins.list[Document]

Asynchronously list documents for an entity type, optionally filtered.

See list for the filter grammar and its limits.

Arguments:

  • entity_type_name - Visual Investigator entity type name.
  • start - Zero-based offset into the collection.
  • limit - Maximum number of documents to return.
  • depth - Data Hub depth parameter ("0" no children, "1" with).
  • filter_ - Raw filter expression, ANDed with where when both are given.
  • where - Field-name → value equality constraints, ANDed together.
  • sort_by - "<field>:ascending" or "<field>:descending".

Returns:

Bound documents for the requested page.

Raises:

  • ValidationError - If a where key is not a valid field name or a value is not a supported scalar.
  • DocumentOperationError - If the Data Hub rejects the read.

list_all​

def list_all(*,
entity_type_name: str,
batch_size: int = 40,
max_items: int | None = None,
depth: str = "0",
filter_: str | None = None,
where: Mapping[str, str | int | float | bool] | None = None,
sort_by: str | None = None) -> builtins.list[Document]

List every document of an entity type, paging until exhausted.

Arguments:

  • entity_type_name - Visual Investigator entity type name.
  • batch_size - Page size per request; must be greater than 0.
  • max_items - Optional ceiling on the number of documents returned.
  • depth - Data Hub depth parameter ("0" no children, "1" with).
  • filter_ - Raw filter expression; see list for the grammar.
  • where - Field-name → value equality constraints, ANDed together.
  • sort_by - "<field>:ascending" or "<field>:descending".

Returns:

Every matching bound document.

Raises:

  • DocumentOperationError - If batch_size is not greater than 0 or the Data Hub rejects a page.
  • ValidationError - If a where key or value is not valid.

list_all_async​

async def list_all_async(
*,
entity_type_name: str,
batch_size: int = 40,
max_items: int | None = None,
depth: str = "0",
filter_: str | None = None,
where: Mapping[str, str | int | float | bool] | None = None,
sort_by: str | None = None) -> builtins.list[Document]

Asynchronously list every document of an entity type.

Arguments:

  • entity_type_name - Visual Investigator entity type name.
  • batch_size - Page size per request; must be greater than 0.
  • max_items - Optional ceiling on the number of documents returned.
  • depth - Data Hub depth parameter ("0" no children, "1" with).
  • filter_ - Raw filter expression; see list for the grammar.
  • where - Field-name → value equality constraints, ANDed together.
  • sort_by - "<field>:ascending" or "<field>:descending".

Returns:

Every matching bound document.

Raises:

  • DocumentOperationError - If batch_size is not greater than 0 or the Data Hub rejects a page.
  • ValidationError - If a where key or value is not valid.

get_many​

def get_many(*,
entity_type_name: str,
document_ids: Sequence[str],
depth: str = "0") -> builtins.list[Document]

Fetch several documents of one entity type by id in a few requests.

Ids are de-duplicated (first occurrence wins), requested in chunks of 100, and the result is returned in the input order. Ids the server does not know are omitted, so compare len(result) with the number of distinct ids you asked for when every document must exist.

Arguments:

  • entity_type_name - Visual Investigator entity type name.
  • document_ids - Document identifiers to fetch.
  • depth - Data Hub depth parameter ("0" no children, "1" with).

Returns:

Bound documents in input order; empty when document_ids is empty.

Raises:

  • DocumentOperationError - If an id is not a non-empty string or the Data Hub rejects a chunk.

get_many_async​

async def get_many_async(*,
entity_type_name: str,
document_ids: Sequence[str],
depth: str = "0") -> builtins.list[Document]

Asynchronously fetch several documents of one entity type by id.

Chunks are requested one after another; see get_many for the ordering and missing-id contract.

Arguments:

  • entity_type_name - Visual Investigator entity type name.
  • document_ids - Document identifiers to fetch.
  • depth - Data Hub depth parameter ("0" no children, "1" with).

Returns:

Bound documents in input order; empty when document_ids is empty.

Raises:

  • DocumentOperationError - If an id is not a non-empty string or the Data Hub rejects a chunk.

create​

def create(*,
entity_type_name: str,
field_values: dict[str, Any] | None = None,
**extra: Any) -> Document

Create a managed document.

Arguments:

  • entity_type_name - Visual Investigator entity type name.
  • field_values - Initial field values keyed by VI field name.
  • **extra - Additional raw payload properties forwarded to Data Hub.

Returns:

The created bound document.

Raises:

  • DocumentRuntimeError - If the entity type is not mutable or the create request fails.
  • MalformedResponseError - If the server answered 201 with a body the SDK cannot read, or one that names no document id (missing, null or empty). The document was probably created; status_code carries the 201.

create_async​

async def create_async(*,
entity_type_name: str,
field_values: dict[str, Any] | None = None,
**extra: Any) -> Document

Create a managed document without blocking the event loop.

Arguments:

  • entity_type_name - Visual Investigator entity type name.
  • field_values - Initial field values keyed by VI field name.
  • **extra - Additional raw payload properties forwarded to Data Hub.

Returns:

The created bound document.

Raises:

  • DocumentRuntimeError - If the entity type is not mutable or the create request fails.
  • MalformedResponseError - If the server answered 201 with a body the SDK cannot read, or one that names no document id (missing, null or empty). The document was probably created; status_code carries the 201.

bulk_upsert​

def bulk_upsert(
documents: Iterable[Mapping[str, Any] | BaseVIEntity],
*,
masked: bool = False,
chunk_size: int | None = None) -> builtins.list[BulkOperationResult]

Bulk create/update documents via POST /documents/bulk.

A row without a top-level id is a create. A row with one is an update, and the server requires the document's existing audit fields (created_at_dttm, last_updated_at_dttm, version, and the primary key) in fieldValues, so an update is a read-modify-write::

document = client.documents.get( entity_type_name="person", document_id=doc_id ) values = dict(document.fields) values["last_name"] = "Updated" client.documents.bulk_upsert( [{"objectTypeName": "person", "id": doc_id, "fieldValues": values}] )

Sending only the changed fields fails that row with DH6916; the primary key in fieldValues without a top-level id is read as an insert and fails with DH5118.

Arguments:

  • documents - Items to upsert. Each may be a raw VI document payload (Mapping) or a BaseVIEntity instance.
  • masked - When True, sends the masked-document Content-Item-Type header.
  • chunk_size - When set (>0), split the input into sequential chunks of this many items, POST each separately, and aggregate all result rows (including failures) across chunks. When None (default) the whole input is sent in a single request. Inputs are buffered one chunk at a time; max_response_bytes bounds responses, not the request body.

Returns:

One result row per input item. Inspect .succeeded / .error for partial failures; raise on errors with sasvi.documents.raise_on_errors.

Raises:

  • BulkRequestError - If a request fails or answers with the wrong number of rows; the rows confirmed before it are attached as completed.
  • DocumentOperationError - If chunk_size is set and is not a positive integer.

bulk_upsert_async​

async def bulk_upsert_async(
documents: Iterable[Mapping[str, Any] | BaseVIEntity],
*,
masked: bool = False,
chunk_size: int | None = None) -> builtins.list[BulkOperationResult]

Asynchronously bulk create/update documents via POST /documents/bulk.

Same chunking, row aggregation and failure semantics as bulk_upsert, with each chunk's request awaited.

A row without a top-level id is a create. A row with one is an update, and the server requires the document's existing audit fields (created_at_dttm, last_updated_at_dttm, version, and the primary key) in fieldValues, so an update is a read-modify-write::

document = await client.documents.get_async( entity_type_name="person", document_id=doc_id ) values = dict(document.fields) values["last_name"] = "Updated" await client.documents.bulk_upsert_async( [{"objectTypeName": "person", "id": doc_id, "fieldValues": values}] )

Sending only the changed fields fails that row with DH6916; the primary key in fieldValues without a top-level id is read as an insert and fails with DH5118.

Arguments:

  • documents - Items to upsert. Each may be a raw VI document payload (Mapping) or a BaseVIEntity instance.
  • masked - When True, sends the masked-document Content-Item-Type header.
  • chunk_size - When set (>0), split the input into sequential chunks of this many items, POST each separately, and aggregate all result rows (including failures) across chunks. When None (default) the whole input is sent in a single request. Inputs are buffered one chunk at a time; max_response_bytes bounds responses, not the request body.

Returns:

One result row per input item. Inspect .succeeded / .error for partial failures; raise on errors with sasvi.documents.raise_on_errors.

Raises:

  • BulkRequestError - If a request fails or answers with the wrong number of rows; the rows confirmed before it are attached as completed.
  • DocumentOperationError - If chunk_size is set and is not a positive integer.
def bulk_upsert_links(links: Iterable[Mapping[str, Any]],
*,
chunk_size: int | None = None
) -> builtins.list[BulkLinkOperationResult]

Bulk create/update relationship links via POST /links/bulk.

The links are stored straight away but may not reach the search graph until the relationship types are reindexed, so search and the network view can show the records unlinked. Run svi.admin.indexing.start_for(...) on the loaded relationship types and their endpoint entities afterwards.

Arguments:

  • links - Relationship link payloads to upsert, in the Data Hub DocumentLink shape (relationshipTypeName, fromObjectTypeName, fromObjectId, toObjectTypeName, toObjectId, optional fieldValues). An item with the link id updates that link. "@type": "DocumentLink" is added when absent.
  • chunk_size - When set (>0), split the input into sequential chunks of this many items, POST each separately, and aggregate all result rows (including failures) across chunks. When None (default) the whole input is sent in a single request. Inputs are buffered one chunk at a time; max_response_bytes bounds responses, not the request body.

Raises:

  • BulkRequestError - If a request fails or answers with the wrong number of rows, or a create item lacks a required field; the rows confirmed before it are attached as completed.
  • DocumentOperationError - If chunk_size is set and is not a positive integer.
async def bulk_upsert_links_async(links: Iterable[Mapping[str, Any]],
*,
chunk_size: int | None = None
) -> builtins.list[BulkLinkOperationResult]

Asynchronously bulk create/update relationship links via POST /links/bulk.

Same chunking, row aggregation and failure semantics as bulk_upsert_links, with each chunk's request awaited.

The links are stored straight away but may not reach the search graph until the relationship types are reindexed, so search and the network view can show the records unlinked. Run svi.admin.indexing.start_for(...) on the loaded relationship types and their endpoint entities afterwards.

Arguments:

  • links - Relationship link payloads to upsert, in the Data Hub DocumentLink shape (relationshipTypeName, fromObjectTypeName, fromObjectId, toObjectTypeName, toObjectId, optional fieldValues). An item with the link id updates that link. "@type": "DocumentLink" is added when absent.
  • chunk_size - When set (>0), split the input into sequential chunks of this many items, POST each separately, and aggregate all result rows (including failures) across chunks. When None (default) the whole input is sent in a single request. Inputs are buffered one chunk at a time; max_response_bytes bounds responses, not the request body.

Returns:

One result row per input item. Inspect .succeeded / .error for partial failures.

Raises:

  • BulkRequestError - If a request fails or answers with the wrong number of rows, or a create item lacks a required field; the rows confirmed before it are attached as completed.
  • DocumentOperationError - If chunk_size is set and is not a positive integer.

submit_async_job​

def submit_async_job(*,
parameters: Mapping[str, Any],
tasks: Sequence[Mapping[str, Any]] | None = None,
name: str | None = None,
description: str | None = None,
tags: Sequence[str] | None = None,
version: int = 1) -> JobHandle

Submit a server-side async job via POST /admin/asyncJobs.

Status monitoring lives on a separate service and is not yet wrapped; the returned JobHandle exposes the fields populated on submission.

The parameters mapping names the job type, as in::

{"type": "SEARCH_INDEX_LOADER"}

A tasks entry is a raw task object, as the Data Hub definition documents it::

{"version": 1, "parameters": {"type": "LOAD_DOCUMENT", "name": "<entity>"}}

Arguments:

  • parameters - The job parameters, naming the job type.
  • tasks - Optional per-task payloads scoping the job. A job that names no task indexes everything.
  • name - Optional human-readable name.
  • description - Optional description.
  • tags - Optional tags used for later lookup.
  • version - Schema version sent on the job payload.

Returns:

A JobHandle for the submitted job.

Raises:

  • DocumentOperationError - When the server rejects the submission or answers without a payload.

submit_async_job_async​

async def submit_async_job_async(*,
parameters: Mapping[str, Any],
tasks: Sequence[Mapping[str, Any]]
| None = None,
name: str | None = None,
description: str | None = None,
tags: Sequence[str] | None = None,
version: int = 1) -> JobHandle

Asynchronously submit a server-side async job via POST /admin/asyncJobs.

Same payload and answer handling as submit_async_job.

Status monitoring lives on a separate service and is not yet wrapped; the returned JobHandle exposes the fields populated on submission.

The parameters mapping names the job type, as in::

{"type": "SEARCH_INDEX_LOADER"}

A tasks entry is a raw task object, as the Data Hub definition documents it::

{"version": 1, "parameters": {"type": "LOAD_DOCUMENT", "name": "<entity>"}}

Arguments:

  • parameters - The job parameters, naming the job type.
  • tasks - Optional per-task payloads scoping the job. A job that names no task indexes everything.
  • name - Optional human-readable name.
  • description - Optional description.
  • tags - Optional tags used for later lookup.
  • version - Schema version sent on the job payload.

Returns:

A JobHandle for the submitted job.

Raises:

  • DocumentOperationError - When the server rejects the submission or answers without a payload.

Private helpers shared by the document and link history readers.

Validates the action_type filter accepted by the action-history readers and renders it into the pipe-joined query value the Data Hub expects.

Render document insight cells as human-readable Markdown.

Converts insight cell payloads into a compact Markdown document suitable for previews and exports. The payloads are text cells, whose HTML is normalized to Markdown, image cells, and network-graph cells.

render_insight_markdown​

def render_insight_markdown(*,
insight_name: str | None,
cells: Sequence[Any],
base_url: str | None = None,
include_cell_headings: bool = False) -> str

Render insight cells into readable markdown.

Arguments:

  • insight_name - Optional insight title used as the markdown heading.
  • cells - Insight cell handles, models, or payloads to render.
  • base_url - Optional Viya base URL used to absolutize image links.
  • include_cell_headings - Whether to add explicit cell boundary headings.

Returns:

Markdown representation of the supplied insight cells.

Bound per-document manager helpers for related-resource operations.

Each manager wraps a DocumentRuntime (or ChildDocumentRuntime) bound to one document and exposes a small, discoverable surface for comments, attachments, images, conditions, relationships, and history. Each returns handwritten record wrappers rather than raw generated models. They are constructed and attached by the Document wrapper, not instantiated directly.

AttachmentId​

CommentsManager Objects​

class CommentsManager()

Bound helper for comment operations on one document.

Arguments:

  • runtime - Document runtime bound to the current document snapshot.

list​

def list(*, start: int = 0, limit: int = 50) -> builtins.list[CommentRecord]

List comments attached to the current document.

Arguments:

  • start - Zero-based page offset.
  • limit - Maximum number of comments to return.

Returns:

Handwritten CommentRecord wrappers. Each exposes clean X | None properties plus .raw for the generated Comment model.

Raises:

  • DocumentNotFoundError - If the document does not exist.
  • DocumentOperationError - If the Data Hub refuses the read.

list_async​

async def list_async(*,
start: int = 0,
limit: int = 50) -> builtins.list[CommentRecord]

Asynchronously list comments attached to the current document.

Arguments:

  • start - Zero-based page offset.
  • limit - Maximum number of comments to return.

Returns:

Handwritten CommentRecord wrappers.

Raises:

  • DocumentNotFoundError - If the document does not exist.
  • DocumentOperationError - If the Data Hub refuses the read.

create​

def create(
*,
text: str,
category: CommentCategory | str = "GENERAL"
) -> builtins.list[CommentRecord]

Create a comment on the current document.

Arguments:

  • text - Comment body text.
  • category - VI comment category code (see sasvi.types.CommentCategory).

Returns:

The refreshed comment list (as CommentRecord wrappers) after the new comment is created.

Raises:

  • DocumentNotFoundError - If the document does not exist.
  • DocumentOperationError - If the Data Hub refuses the comment, for example for an unknown category.

create_async​

async def create_async(*,
text: str,
category: CommentCategory | str = "GENERAL"
) -> builtins.list[CommentRecord]

Asynchronously create a comment on the current document.

Arguments:

  • text - Comment body text.
  • category - VI comment category code (see sasvi.types.CommentCategory).

Returns:

The refreshed comment list after the new comment is created.

Raises:

  • DocumentNotFoundError - If the document does not exist.
  • DocumentOperationError - If the Data Hub refuses the comment, for example for an unknown category.

update_category​

def update_category(*, comment_id: int,
category: CommentCategory | str) -> CommentRecord

Change the category of one existing comment.

The category is the only mutable property of a comment: the Data Hub keeps the text, author, and timestamps read-only for audit accuracy.

Arguments:

  • comment_id - Identifier of the comment to re-categorize.
  • category - New category code (see sasvi.types.CommentCategory).

Returns:

The updated comment.

Raises:

  • DocumentNotFoundError - If no comment with comment_id exists on the document.
  • DocumentOperationError - If the Data Hub rejects the update.

update_category_async​

async def update_category_async(
*, comment_id: int, category: CommentCategory | str) -> CommentRecord

Asynchronously change the category of one existing comment.

Arguments:

  • comment_id - Identifier of the comment to re-categorize.
  • category - New category code (see sasvi.types.CommentCategory).

Returns:

The updated comment.

Raises:

  • DocumentNotFoundError - If no comment with comment_id exists on the document.
  • DocumentOperationError - If the Data Hub rejects the update.

categories​

def categories() -> builtins.list[CommentCategoryRecord]

List the comment categories in use on the document with their counts.

Returns:

One record per category that has at least one comment.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

categories_async​

async def categories_async() -> builtins.list[CommentCategoryRecord]

Asynchronously list the comment categories in use on the document.

Returns:

One record per category that has at least one comment.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

AttachmentsManager Objects​

class AttachmentsManager()

Bound helper for attachment operations on one document.

Arguments:

  • runtime - Document runtime bound to the current document snapshot.

list​

def list() -> builtins.list[AttachmentRecord]

List attachments on the current document.

Every file of category Attachment is returned, whatever its content type, and so is every file of another category that is not an image, such as one uploaded with upload(category=...). An image filed under an image category is what VI's image gallery shows; it is returned by images.list(), not here.

Returns:

AttachmentRecord wrappers. Each exposes clean X | None properties plus .raw for the generated File model.

Raises:

  • IncompleteListingError - If the service stopped advancing while the files were being listed.

list_async​

async def list_async() -> builtins.list[AttachmentRecord]

Asynchronously list attachments on the current document.

Returns the same files as list.

Returns:

AttachmentRecord wrappers.

Raises:

  • IncompleteListingError - If the service stopped advancing while the files were being listed.

get​

def get(*, attachment_id: AttachmentId) -> AttachmentRecord | None

Fetch one attachment by id.

Arguments:

  • attachment_id - Attachment identifier or UUID.

Returns:

The attachment record, or None when no attachment matches.

get_async​

async def get_async(*, attachment_id: AttachmentId) -> AttachmentRecord | None

Asynchronously fetch one attachment by id.

Arguments:

  • attachment_id - Attachment identifier or UUID.

Returns:

The attachment record, or None when no attachment matches.

download​

def download(*, attachment_id: AttachmentId) -> bytes

Download one attachment's binary content.

Arguments:

  • attachment_id - Attachment identifier or UUID.

Returns:

Raw attachment bytes.

Notes:

The entire attachment is buffered in memory and returned as bytes. For a large attachment use download_to or iter_bytes.

download_async​

async def download_async(*, attachment_id: AttachmentId) -> bytes

Asynchronously download one attachment's binary content.

Arguments:

  • attachment_id - Attachment identifier or UUID.

Returns:

Raw attachment bytes.

Notes:

The entire attachment is buffered in memory and returned as bytes. For a large attachment use download_to_async or iter_bytes_async.

iter_bytes​

def iter_bytes(*,
attachment_id: AttachmentId,
chunk_size: int | None = None) -> Iterator[bytes]

Stream one attachment's content in chunks.

download returns the whole attachment as one bytes. This yields it piece by piece, so memory use does not grow with the file. The bytes yielded count against max_response_bytes. The request is sent once, without retries.

Arguments:

  • attachment_id - Attachment identifier or UUID.
  • chunk_size - Largest chunk to yield, 256 KiB by default.

Returns:

An iterator over the attachment's bytes, in order.

Raises:

  • DocumentOperationError - If the attachment does not exist, or the content route answers another error status (the typed subclass for that status is raised).
  • ResponseTooLargeError - If the body passes max_response_bytes.
  • NetworkError - If the transfer fails before it completes, including ServiceUnreachableError and TLSError.

iter_bytes_async​

def iter_bytes_async(*,
attachment_id: AttachmentId,
chunk_size: int | None = None) -> AsyncIterator[bytes]

Asynchronously stream one attachment's content in chunks.

Use it with async for. The bytes yielded count against max_response_bytes. The request is sent once, without retries.

Arguments:

  • attachment_id - Attachment identifier or UUID.
  • chunk_size - Largest chunk to yield, 256 KiB by default.

Returns:

An async iterator over the attachment's bytes, in order.

Raises:

  • DocumentOperationError - If the attachment does not exist, or the content route answers another error status (the typed subclass for that status is raised).
  • ResponseTooLargeError - If the body passes max_response_bytes.
  • NetworkError - If the transfer fails before it completes, including ServiceUnreachableError and TLSError.

download_to​

def download_to(path: str | os.PathLike[str],
*,
attachment_id: AttachmentId,
overwrite: bool = True) -> Path

Stream one attachment into a file.

The file is written with mode 0600 to a temporary name in the same directory and moved into place after the last byte, so a failed download leaves an existing file as it was. A symlink at path is refused.

Arguments:

  • path - Destination file path.
  • attachment_id - Attachment identifier or UUID.
  • overwrite - Replace an existing regular file when True.

Returns:

The destination path.

Raises:

  • DocumentOperationError - If the attachment does not exist, or the content route answers another error status (the typed subclass for that status is raised).
  • ResponseTooLargeError - If the body passes max_response_bytes.
  • NetworkError - If the transfer fails before it completes, including ServiceUnreachableError and TLSError.
  • FileNotFoundError - If the parent directory of path does not exist. It is not created, and ~ is not expanded.
  • FileExistsError - If path exists and overwrite is False.
  • OSError - If path is a symlink or cannot be written.

download_to_async​

async def download_to_async(path: str | os.PathLike[str],
*,
attachment_id: AttachmentId,
overwrite: bool = True) -> Path

Asynchronously stream one attachment into a file.

Same file guarantees as download_to. File writes run in a worker thread.

Arguments:

  • path - Destination file path.
  • attachment_id - Attachment identifier or UUID.
  • overwrite - Replace an existing regular file when True.

Returns:

The destination path.

Raises:

  • DocumentOperationError - If the attachment does not exist, or the content route answers another error status (the typed subclass for that status is raised).
  • ResponseTooLargeError - If the body passes max_response_bytes.
  • NetworkError - If the transfer fails before it completes, including ServiceUnreachableError and TLSError.
  • FileNotFoundError - If the parent directory of path does not exist. It is not created, and ~ is not expanded.
  • FileExistsError - If path exists and overwrite is False.
  • OSError - If path is a symlink or cannot be written.

upload​

def upload(*,
file: bytes | bytearray | str | builtins.object,
name: str | None = None,
content_type: str | None = None,
category: str | None = None,
description: str | None = None,
upload_folder_path: str | None = None,
upload_folder_uri: str | None = None) -> AttachmentRecord

Upload a new attachment to the current document.

Arguments:

  • file - Attachment contents as bytes, file path, or file-like object.
  • name - Optional display name. When omitted, the SDK infers it when possible.
  • content_type - Optional MIME type override.
  • category - Optional file category of the document's entity type. Without one, or with "Attachment", the file is stored as category Attachment. Any other category is kept, and the upload fails if the service stores another one.
  • description - Optional attachment description.
  • upload_folder_path - Optional managed-folder path used for staged uploads.
  • upload_folder_uri - Optional managed-folder URI override.

Returns:

The created attachment as an AttachmentRecord wrapper.

Raises:

  • DocumentOperationError - If the service refused the upload or the category, or stored the file under a category other than category. In the last case the file stays attached and the error's raw holds what the service stored.
  • DocumentNotFoundError - If the document no longer exists.

Notes:

A path or a file object is streamed in 256 KiB chunks, so memory use does not grow with the file; bytes are sent as they are. A file object is sent from its current position. The upload is a POST, which the default retry_methods leave out, so a failure mid-body is raised and the body is not resent.

upload_async​

async def upload_async(
*,
file: bytes | bytearray | str | builtins.object,
name: str | None = None,
content_type: str | None = None,
category: str | None = None,
description: str | None = None,
upload_folder_path: str | None = None,
upload_folder_uri: str | None = None) -> AttachmentRecord

Asynchronously upload a new attachment to the current document.

Arguments:

  • file - Attachment contents as bytes, file path, or file-like object.
  • name - Optional display name. When omitted, the SDK infers it when possible.
  • content_type - Optional MIME type override.
  • category - Optional file category of the document's entity type. Without one, or with "Attachment", the file is stored as category Attachment. Any other category is kept, and the upload fails if the service stores another one.
  • description - Optional attachment description.
  • upload_folder_path - Optional managed-folder path used for staged uploads.
  • upload_folder_uri - Optional managed-folder URI override.

Returns:

The created attachment as an AttachmentRecord wrapper.

Raises:

  • DocumentOperationError - If the service refused the upload or the category, or stored the file under a category other than category. In the last case the file stays attached and the error's raw holds what the service stored.
  • DocumentNotFoundError - If the document no longer exists.

Notes:

A path or a file object is streamed in 256 KiB chunks, so memory use does not grow with the file; bytes are sent as they are. A file object is sent from its current position. The upload is a POST, which the default retry_methods leave out, so a failure mid-body is raised and the body is not resent.

Each chunk of a path or file object is read on the event loop. When the task is cancelled after the file is stored but before it is attached, the stored file is deleted, and that delete finishes even if the caller is cancelled again.

delete​

def delete(*, attachment_id: AttachmentId) -> None

Delete one attachment from the current document.

Arguments:

  • attachment_id - Attachment identifier or UUID.

Raises:

  • DocumentNotFoundError - If no attachment with that id is attached.
  • DocumentConflictError - If the attachment changed since its ETag was read (412). The delete is not resent without If-Match; refresh the document and retry.
  • DocumentOperationError - If the Data Hub refuses the delete, or the attachment is still listed after it.

delete_async​

async def delete_async(*, attachment_id: AttachmentId) -> None

Asynchronously delete one attachment from the current document.

Arguments:

  • attachment_id - Attachment identifier or UUID.

Raises:

  • DocumentNotFoundError - If no attachment with that id is attached.
  • DocumentConflictError - If the attachment changed since its ETag was read (412). The delete is not resent without If-Match; refresh the document and retry.
  • DocumentOperationError - If the Data Hub refuses the delete, or the attachment is still listed after it.

ImagesManager Objects​

class ImagesManager()

Bound helper for image/file-image operations on one document.

Arguments:

  • runtime - Document runtime bound to the current document snapshot.

list​

def list() -> builtins.list[AttachmentRecord]

List the images on the current document, whatever their category.

Returns:

One record per file whose content type is an image: images filed under an image category and image files stored as attachments.

Raises:

  • IncompleteListingError - If the service stopped advancing while the files were being listed.

list_async​

async def list_async() -> builtins.list[AttachmentRecord]

Asynchronously list the images on the current document, whatever their category.

Returns:

One record per file whose content type is an image: images filed under an image category and image files stored as attachments.

Raises:

  • IncompleteListingError - If the service stopped advancing while the files were being listed.

get​

def get(*, attachment_id: AttachmentId) -> AttachmentRecord | None

Fetch one image attachment by id.

Arguments:

  • attachment_id - Image attachment identifier or UUID.

Returns:

The image record, or None when no image matches.

get_async​

async def get_async(*, attachment_id: AttachmentId) -> AttachmentRecord | None

Asynchronously fetch one image attachment by id.

Arguments:

  • attachment_id - Image attachment identifier or UUID.

Returns:

The image record, or None when no image matches.

download​

def download(*, attachment_id: AttachmentId) -> bytes

Download one image attachment's binary content.

Arguments:

  • attachment_id - Image attachment identifier or UUID.

Returns:

Raw image bytes.

Raises:

  • DocumentNotFoundError - If no image with that id is attached.
  • DocumentOperationError - If the Data Hub refuses the read.

Notes:

The entire image is buffered in memory and returned as bytes. To stream a large image instead, pass the same id to attachments.iter_bytes or attachments.download_to; an image is an attachment with an image content type.

download_async​

async def download_async(*, attachment_id: AttachmentId) -> bytes

Asynchronously download one image attachment's binary content.

Arguments:

  • attachment_id - Image attachment identifier or UUID.

Returns:

Raw image bytes.

Raises:

  • DocumentNotFoundError - If no image with that id is attached.
  • DocumentOperationError - If the Data Hub refuses the read.

Notes:

The entire image is buffered in memory and returned as bytes. To stream a large image instead, pass the same id to attachments.iter_bytes or attachments.download_to; an image is an attachment with an image content type.

upload​

def upload(*,
file: bytes | bytearray | str | builtins.object,
name: str | None = None,
content_type: str | None = None,
category: str | None = None,
description: str | None = None,
upload_folder_path: str | None = None,
upload_folder_uri: str | None = None) -> AttachmentRecord

Upload a new image attachment to the current document.

Arguments:

  • file - Image contents as bytes, file path, or file-like object.
  • name - Optional display name. When omitted, the SDK infers it when possible.
  • content_type - Optional MIME type override.
  • category - Image category of the document's entity type, such as photo. Optional, but VI's image gallery shows only images filed under an image category; without one the image is stored as an ordinary attachment.
  • description - Optional image description.
  • upload_folder_path - Optional managed-folder path used for staged uploads.
  • upload_folder_uri - Optional managed-folder URI override.

Returns:

The created image as an AttachmentRecord wrapper.

Raises:

  • DocumentOperationError - If the content type is not an image, the service refused the upload or the category, or it stored the image under a category other than category. In the last case the image stays attached.
  • DocumentNotFoundError - If the document no longer exists.

Notes:

A path or a file object is streamed in 256 KiB chunks, so memory use does not grow with the file; bytes are sent as they are. A file object is sent from its current position. The upload is a POST, which the default retry_methods leave out, so a failure mid-body is raised and the body is not resent.

upload_async​

async def upload_async(
*,
file: bytes | bytearray | str | builtins.object,
name: str | None = None,
content_type: str | None = None,
category: str | None = None,
description: str | None = None,
upload_folder_path: str | None = None,
upload_folder_uri: str | None = None) -> AttachmentRecord

Asynchronously upload a new image attachment to the current document.

Arguments:

  • file - Image contents as bytes, file path, or file-like object.
  • name - Optional display name. When omitted, the SDK infers it when possible.
  • content_type - Optional MIME type override.
  • category - Image category of the document's entity type, such as photo. Optional, but VI's image gallery shows only images filed under an image category; without one the image is stored as an ordinary attachment.
  • description - Optional image description.
  • upload_folder_path - Optional managed-folder path used for staged uploads.
  • upload_folder_uri - Optional managed-folder URI override.

Returns:

The created image as an AttachmentRecord wrapper.

Raises:

  • DocumentOperationError - If the content type is not an image, the service refused the upload or the category, or it stored the image under a category other than category. In the last case the image stays attached.
  • DocumentNotFoundError - If the document no longer exists.

Notes:

A path or a file object is streamed in 256 KiB chunks, so memory use does not grow with the file; bytes are sent as they are. A file object is sent from its current position. The upload is a POST, which the default retry_methods leave out, so a failure mid-body is raised and the body is not resent.

Each chunk of a path or file object is read on the event loop. When the task is cancelled after the file is stored but before it is attached, the stored file is deleted, and that delete finishes even if the caller is cancelled again.

delete​

def delete(*, attachment_id: AttachmentId) -> None

Delete one image attachment from the current document.

Arguments:

  • attachment_id - Image attachment identifier or UUID.

Raises:

  • DocumentNotFoundError - If no attachment with that id is attached.
  • DocumentConflictError - If the attachment changed since its ETag was read (412). The delete is not resent without If-Match; refresh the document and retry.
  • DocumentOperationError - If the Data Hub refuses the delete, or the attachment is still listed after it.

delete_async​

async def delete_async(*, attachment_id: AttachmentId) -> None

Asynchronously delete one image attachment from the current document.

Arguments:

  • attachment_id - Image attachment identifier or UUID.

Raises:

  • DocumentNotFoundError - If no attachment with that id is attached.
  • DocumentConflictError - If the attachment changed since its ETag was read (412). The delete is not resent without If-Match; refresh the document and retry.
  • DocumentOperationError - If the Data Hub refuses the delete, or the attachment is still listed after it.

ConditionsManager Objects​

class ConditionsManager()

Bound helper for configured condition operations on one document.

list​

def list() -> builtins.list[ConfiguredConditionRecord]

List configured conditions that apply to this document's type.

Returns:

Condition records evaluable against this document.

list_async​

async def list_async() -> builtins.list[ConfiguredConditionRecord]

Asynchronously list configured conditions for this document's type.

Returns:

Condition records evaluable against this document.

evaluate​

def evaluate(
*,
condition_ids: builtins.list[str] | None = None
) -> builtins.list[DocumentConditionEvaluationResult]

Evaluate conditions against the current document snapshot.

Arguments:

  • condition_ids - Conditions to evaluate. When None, evaluates every condition returned by list.

Returns:

One evaluation result per condition.

evaluate_async​

async def evaluate_async(
*,
condition_ids: builtins.list[str] | None = None
) -> builtins.list[DocumentConditionEvaluationResult]

Asynchronously evaluate conditions against the current document.

Arguments:

  • condition_ids - Conditions to evaluate. When None, evaluates every condition returned by list_async.

Returns:

One evaluation result per condition.

RelationshipsManager Objects​

class RelationshipsManager()

Bound helper for relationship links on one document.

Every id-addressed method first verifies that the link touches the bound document, so a link id from another document cannot be read, edited, or removed through this manager.

Arguments:

  • runtime - Document runtime bound to the current document snapshot.

list​

def list(*,
start: int = 0,
limit: int = 100,
relationship_name: str | None = None
) -> builtins.list[RelationshipLinkRecord]

List relationship links connected to the current document.

The Data Hub has no server-side paging for this listing: every link of the document is read on each call, and start and limit slice that result client-side.

Arguments:

  • start - Zero-based page offset.
  • limit - Maximum number of links to return.
  • relationship_name - Optional relationship type name filter.

Returns:

RelationshipLinkRecord wrappers. Each exposes clean X | None properties plus .raw for the generated model.

list_async​

async def list_async(*,
start: int = 0,
limit: int = 100,
relationship_name: str | None = None
) -> builtins.list[RelationshipLinkRecord]

Asynchronously list relationship links connected to the document.

See list: every link is read and sliced client-side.

Arguments:

  • start - Zero-based page offset.
  • limit - Maximum number of links to return.
  • relationship_name - Optional relationship type name filter.

Returns:

RelationshipLinkRecord wrappers.

get​

def get(*, relationship_link_id: str) -> RelationshipLinkRecord | None

Fetch one relationship link of the current document by id.

Arguments:

  • relationship_link_id - Relationship-link identifier.

Returns:

The link record, or None when no link has that id.

Raises:

  • DocumentOperationError - If the link exists but does not touch the current document.

get_async​

async def get_async(
*, relationship_link_id: str) -> RelationshipLinkRecord | None

Asynchronously fetch one relationship link of the current document.

Arguments:

  • relationship_link_id - Relationship-link identifier.

Returns:

The link record, or None when no link has that id.

Raises:

  • DocumentOperationError - If the link exists but does not touch the current document.

create​

def create(other: object | None = None,
*,
body: Mapping[str, Any] | object | None = None,
relationship: str | None = None,
field_values: Mapping[str, Any] | None = None,
valid_from: datetime | str | None = None,
valid_to: datetime | str | None = None) -> RelationshipLinkRecord

Create one relationship link from the current document.

Arguments:

  • other - Target document: a bound Document, a (type, id) tuple, or any object exposing document-like identifier attributes. Required unless body is given.
  • body - Advanced escape hatch: a full RelationshipLink model or wire-shaped dict sent as-is. Mutually exclusive with the other arguments.
  • relationship - Relationship type name or qualified name. Optional when exactly one type is valid between the two document types.
  • field_values - Optional relationship field values keyed by name.
  • valid_from - Optional validity start as a datetime or ISO-8601 string.
  • valid_to - Optional validity end as a datetime or ISO-8601 string.

Returns:

The created relationship link.

Raises:

  • DocumentOperationError - If body is mixed with the structured arguments, neither other nor body is given, the relationship type cannot be resolved, or the document's entity type is a SOURCE type.
  • MalformedResponseError - If the server accepted the create but its answer names no link; the link may exist.

create_async​

async def create_async(
other: object | None = None,
*,
body: Mapping[str, Any] | object | None = None,
relationship: str | None = None,
field_values: Mapping[str, Any] | None = None,
valid_from: datetime | str | None = None,
valid_to: datetime | str | None = None) -> RelationshipLinkRecord

Asynchronously create one relationship link from the current document.

Arguments:

  • other - Target document: a bound Document, a (type, id) tuple, or any object exposing document-like identifier attributes. Required unless body is given.
  • body - Advanced escape hatch: a full RelationshipLink model or wire-shaped dict sent as-is. Mutually exclusive with the other arguments.
  • relationship - Relationship type name or qualified name.
  • field_values - Optional relationship field values keyed by name.
  • valid_from - Optional validity start as a datetime or ISO-8601 string.
  • valid_to - Optional validity end as a datetime or ISO-8601 string.

Returns:

The created relationship link.

Raises:

  • DocumentOperationError - If body is mixed with the structured arguments, neither other nor body is given, the relationship type cannot be resolved, or the document's entity type is a SOURCE type.
  • MalformedResponseError - If the server accepted the create but its answer names no link; the link may exist.

update​

def update(*,
relationship_link_id: str,
changes: RelationshipLinkUpdate | None = None,
field_values: Mapping[str, Any] | None = None,
valid_from: datetime | str | None = None,
valid_to: datetime | str | None = None,
body: Any | None = None,
if_match: str | None = None) -> RelationshipLinkRecord

Edit one relationship link of the current document.

Delegates to client.documents.relationships.update after verifying that the link touches the current document and that the document type is writable.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • changes - Typed partial update. Mutually exclusive with the loose keyword arguments and with body.
  • field_values - Field values to merge onto the link's existing values.
  • valid_from - New validity start (None leaves it unchanged).
  • valid_to - New validity end (None leaves it unchanged).
  • body - Advanced escape hatch: a full RelationshipLink model or wire-shaped dict sent as-is; pair it with if_match.
  • if_match - ETag of the link as the caller last read it, sent as If-Match so a link changed since then fails with 412.

Returns:

The updated relationship link.

Raises:

  • DocumentOperationError - If the document type is read-only, the link does not touch the current document, or the arguments conflict.
  • DocumentNotFoundError - If no link has that id.
  • DocumentConflictError - If the link changed since it was read (412).

update_async​

async def update_async(*,
relationship_link_id: str,
changes: RelationshipLinkUpdate | None = None,
field_values: Mapping[str, Any] | None = None,
valid_from: datetime | str | None = None,
valid_to: datetime | str | None = None,
body: Any | None = None,
if_match: str | None = None) -> RelationshipLinkRecord

Asynchronously edit one relationship link of the current document.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • changes - Typed partial update. Mutually exclusive with the loose keyword arguments and with body.
  • field_values - Field values to merge onto the link's existing values.
  • valid_from - New validity start (None leaves it unchanged).
  • valid_to - New validity end (None leaves it unchanged).
  • body - Advanced escape hatch: a full RelationshipLink model or wire-shaped dict sent as-is; pair it with if_match.
  • if_match - ETag of the link as the caller last read it, sent as If-Match so a link changed since then fails with 412.

Returns:

The updated relationship link.

Raises:

  • DocumentOperationError - If the document type is read-only, the link does not touch the current document, or the arguments conflict.
  • DocumentNotFoundError - If no link has that id.
  • DocumentConflictError - If the link changed since it was read (412).

remove​

def remove(*, relationship_link_id: str) -> None

Remove one relationship link by id.

Removing a relationship link detaches the association between two documents; the documents themselves are left intact.

Arguments:

  • relationship_link_id - Relationship-link identifier.

Raises:

  • DocumentNotFoundError - If the link does not exist.
  • DocumentOperationError - If the link does not touch the current document.

remove_async​

async def remove_async(*, relationship_link_id: str) -> None

Asynchronously remove one relationship link by id.

Arguments:

  • relationship_link_id - Relationship-link identifier.

Raises:

  • DocumentNotFoundError - If the link does not exist.
  • DocumentOperationError - If the link does not touch the current document.

versions​

def versions(*,
relationship_link_id: str,
start: int = 0,
limit: int = 40) -> builtins.list[VersionSummaryRecord]

List one page of a link's version history.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • start - Zero-based page offset.
  • limit - Maximum number of versions to return.

Returns:

Version summaries, newest first.

Raises:

  • DocumentNotFoundError - If the link does not exist.
  • DocumentOperationError - If the link does not touch the current document.

versions_async​

async def versions_async(
*,
relationship_link_id: str,
start: int = 0,
limit: int = 40) -> builtins.list[VersionSummaryRecord]

Asynchronously list one page of a link's version history.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • start - Zero-based page offset.
  • limit - Maximum number of versions to return.

Returns:

Version summaries, newest first.

Raises:

  • DocumentNotFoundError - If the link does not exist.
  • DocumentOperationError - If the link does not touch the current document.

versions_all​

def versions_all(
*,
relationship_link_id: str,
batch_size: int = 40,
max_items: int | None = None) -> builtins.list[VersionSummaryRecord]

List a link's whole version history, paging until exhausted.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • batch_size - Page size per request; must be greater than 0.
  • max_items - Optional ceiling on the number of versions returned.

Returns:

Every version summary, newest first.

Raises:

  • DocumentOperationError - If batch_size is not greater than 0, or the link does not exist or does not touch the current document.

versions_all_async​

async def versions_all_async(
*,
relationship_link_id: str,
batch_size: int = 40,
max_items: int | None = None) -> builtins.list[VersionSummaryRecord]

Asynchronously list a link's whole version history.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • batch_size - Page size per request; must be greater than 0.
  • max_items - Optional ceiling on the number of versions returned.

Returns:

Every version summary, newest first.

Raises:

  • DocumentOperationError - If batch_size is not greater than 0, or the link does not exist or does not touch the current document.

version​

def version(*,
relationship_link_id: str,
version: str | int,
changed_only: bool = False) -> VersionRecord | None

Fetch one historical version of a link with its field values.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • version - Version identifier as reported by versions.
  • changed_only - Whether to return only the fields that changed.

Returns:

The version, or None when that version does not exist.

Raises:

  • DocumentNotFoundError - If the link does not exist.
  • DocumentOperationError - If the link does not touch the current document.

version_async​

async def version_async(*,
relationship_link_id: str,
version: str | int,
changed_only: bool = False) -> VersionRecord | None

Asynchronously fetch one historical version of a link.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • version - Version identifier as reported by versions.
  • changed_only - Whether to return only the fields that changed.

Returns:

The version, or None when that version does not exist.

Raises:

  • DocumentNotFoundError - If the link does not exist.
  • DocumentOperationError - If the link does not touch the current document.

actions​

def actions(
*,
relationship_link_id: str,
start: int = 0,
limit: int = 10,
action_type: ActionType | Sequence[ActionType] | None = None,
sort_by: str = "createdAt:descending"
) -> builtins.list[ActionSummaryRecord]

List one page of a link's action history.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • start - Zero-based page offset.
  • limit - Maximum number of actions to return.
  • action_type - One or more sasvi.types.ActionType values to keep.
  • sort_by - <field>:ascending|descending sort expression.

Returns:

Action summaries.

Raises:

  • DocumentOperationError - If action_type holds an unknown value, or the link does not exist or does not touch the current document.

actions_async​

async def actions_async(
*,
relationship_link_id: str,
start: int = 0,
limit: int = 10,
action_type: ActionType | Sequence[ActionType] | None = None,
sort_by: str = "createdAt:descending"
) -> builtins.list[ActionSummaryRecord]

Asynchronously list one page of a link's action history.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • start - Zero-based page offset.
  • limit - Maximum number of actions to return.
  • action_type - One or more sasvi.types.ActionType values to keep.
  • sort_by - <field>:ascending|descending sort expression.

Returns:

Action summaries.

Raises:

  • DocumentOperationError - If action_type holds an unknown value, or the link does not exist or does not touch the current document.

actions_all​

def actions_all(
*,
relationship_link_id: str,
batch_size: int = 50,
max_items: int | None = None,
action_type: ActionType | Sequence[ActionType] | None = None,
sort_by: str = "createdAt:descending"
) -> builtins.list[ActionSummaryRecord]

List a link's whole action history, paging until exhausted.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • batch_size - Page size per request; must be greater than 0.
  • max_items - Optional ceiling on the number of actions returned.
  • action_type - One or more sasvi.types.ActionType values to keep.
  • sort_by - <field>:ascending|descending sort expression.

Returns:

Every matching action summary.

Raises:

  • DocumentOperationError - If batch_size is not greater than 0, action_type holds an unknown value, or the link does not exist or does not touch the current document.

actions_all_async​

async def actions_all_async(
*,
relationship_link_id: str,
batch_size: int = 50,
max_items: int | None = None,
action_type: ActionType | Sequence[ActionType] | None = None,
sort_by: str = "createdAt:descending"
) -> builtins.list[ActionSummaryRecord]

Asynchronously list a link's whole action history.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • batch_size - Page size per request; must be greater than 0.
  • max_items - Optional ceiling on the number of actions returned.
  • action_type - One or more sasvi.types.ActionType values to keep.
  • sort_by - <field>:ascending|descending sort expression.

Returns:

Every matching action summary.

Raises:

  • DocumentOperationError - If batch_size is not greater than 0, action_type holds an unknown value, or the link does not exist or does not touch the current document.

action​

def action(*, relationship_link_id: str,
action_id: str) -> ActionRecord | None

Fetch one action-history entry of a link with its detail blocks.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • action_id - Action identifier as reported by actions.

Returns:

The action, or None when that action does not exist.

Raises:

  • DocumentNotFoundError - If the link does not exist.
  • DocumentOperationError - If the link does not touch the current document.

action_async​

async def action_async(*, relationship_link_id: str,
action_id: str) -> ActionRecord | None

Asynchronously fetch one action-history entry of a link.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • action_id - Action identifier as reported by actions.

Returns:

The action, or None when that action does not exist.

Raises:

  • DocumentNotFoundError - If the link does not exist.
  • DocumentOperationError - If the link does not touch the current document.

HistoryManager Objects​

class HistoryManager()

Bound helper for a document's version, action, and field history.

Versions (versions/version) are the Data Hub's snapshots of the document's field values; actions (actions/action) are the audit trail of who did what to it. Both are the Data Hub document trail. For an alert, the alert service's own audit trail lives on alert.audit.

Arguments:

  • runtime - Document runtime bound to the current document snapshot.

versions​

def versions(
*,
start: int = 0,
limit: int = 40,
sort_by: str | None = None) -> builtins.list[VersionSummaryRecord]

List one page of the document's version history.

Arguments:

  • start - Zero-based page offset.
  • limit - Maximum number of versions to return.
  • sort_by - Optional <field>:ascending|descending sort; the server default (newest first) applies when omitted.

Returns:

Version summaries; empty when the document has no version history.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

versions_async​

async def versions_async(
*,
start: int = 0,
limit: int = 40,
sort_by: str | None = None) -> builtins.list[VersionSummaryRecord]

Asynchronously list one page of the document's version history.

Arguments:

  • start - Zero-based page offset.
  • limit - Maximum number of versions to return.
  • sort_by - Optional <field>:ascending|descending sort.

Returns:

Version summaries; empty when the document has no version history.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

versions_all​

def versions_all(
*,
batch_size: int = 40,
max_items: int | None = None,
sort_by: str | None = None) -> builtins.list[VersionSummaryRecord]

List the document's whole version history, paging until exhausted.

Arguments:

  • batch_size - Page size per request; must be greater than 0.
  • max_items - Optional ceiling on the number of versions returned.
  • sort_by - Optional <field>:ascending|descending sort.

Returns:

Every version summary.

Raises:

  • DocumentOperationError - If batch_size is not greater than 0 or the Data Hub rejects a page.

versions_all_async​

async def versions_all_async(
*,
batch_size: int = 40,
max_items: int | None = None,
sort_by: str | None = None) -> builtins.list[VersionSummaryRecord]

Asynchronously list the document's whole version history.

Arguments:

  • batch_size - Page size per request; must be greater than 0.
  • max_items - Optional ceiling on the number of versions returned.
  • sort_by - Optional <field>:ascending|descending sort.

Returns:

Every version summary.

Raises:

  • DocumentOperationError - If batch_size is not greater than 0 or the Data Hub rejects a page.

version​

def version(*,
version: str | int,
changed_only: bool = False) -> VersionRecord | None

Fetch one historical version of the document with its field values.

Arguments:

  • version - Version identifier as reported by versions.
  • changed_only - Whether to return only the fields that changed.

Returns:

The version, or None when it does not exist.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

version_async​

async def version_async(*,
version: str | int,
changed_only: bool = False) -> VersionRecord | None

Asynchronously fetch one historical version of the document.

Arguments:

  • version - Version identifier as reported by versions.
  • changed_only - Whether to return only the fields that changed.

Returns:

The version, or None when it does not exist.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

version_items​

def version_items(*,
version: str | int,
start: int = 0,
limit: int = 40) -> builtins.list[HistoryInfoRecord]

List the additional history entries recorded for one version.

These describe related items (insights, workspaces, files) that changed as part of the version rather than document fields.

Arguments:

  • version - Version identifier as reported by versions.
  • start - Zero-based page offset.
  • limit - Maximum number of entries to return.

Returns:

History entries; empty when the version has none.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

version_items_async​

async def version_items_async(
*,
version: str | int,
start: int = 0,
limit: int = 40) -> builtins.list[HistoryInfoRecord]

Asynchronously list the additional history entries for one version.

Arguments:

  • version - Version identifier as reported by versions.
  • start - Zero-based page offset.
  • limit - Maximum number of entries to return.

Returns:

History entries; empty when the version has none.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

actions​

def actions(
*,
start: int = 0,
limit: int = 10,
action_type: ActionType | Sequence[ActionType] | None = None,
sort_by: str = "createdAt:descending"
) -> builtins.list[ActionSummaryRecord]

List one page of the document's action history.

Arguments:

  • start - Zero-based page offset.
  • limit - Maximum number of actions to return.
  • action_type - One or more sasvi.types.ActionType values to keep.
  • sort_by - <field>:ascending|descending sort expression.

Returns:

Action summaries; empty when the document has no action history.

Raises:

  • DocumentOperationError - If action_type holds an unknown value or the Data Hub rejects the read.

actions_async​

async def actions_async(
*,
start: int = 0,
limit: int = 10,
action_type: ActionType | Sequence[ActionType] | None = None,
sort_by: str = "createdAt:descending"
) -> builtins.list[ActionSummaryRecord]

Asynchronously list one page of the document's action history.

Arguments:

  • start - Zero-based page offset.
  • limit - Maximum number of actions to return.
  • action_type - One or more sasvi.types.ActionType values to keep.
  • sort_by - <field>:ascending|descending sort expression.

Returns:

Action summaries; empty when the document has no action history.

Raises:

  • DocumentOperationError - If action_type holds an unknown value or the Data Hub rejects the read.

actions_all​

def actions_all(
*,
batch_size: int = 50,
max_items: int | None = None,
action_type: ActionType | Sequence[ActionType] | None = None,
sort_by: str = "createdAt:descending"
) -> builtins.list[ActionSummaryRecord]

List the document's whole action history, paging until exhausted.

Arguments:

  • batch_size - Page size per request; must be greater than 0.
  • max_items - Optional ceiling on the number of actions returned.
  • action_type - One or more sasvi.types.ActionType values to keep.
  • sort_by - <field>:ascending|descending sort expression.

Returns:

Every matching action summary.

Raises:

  • DocumentOperationError - If batch_size is not greater than 0, action_type holds an unknown value, or the Data Hub rejects a page.

actions_all_async​

async def actions_all_async(
*,
batch_size: int = 50,
max_items: int | None = None,
action_type: ActionType | Sequence[ActionType] | None = None,
sort_by: str = "createdAt:descending"
) -> builtins.list[ActionSummaryRecord]

Asynchronously list the document's whole action history.

Arguments:

  • batch_size - Page size per request; must be greater than 0.
  • max_items - Optional ceiling on the number of actions returned.
  • action_type - One or more sasvi.types.ActionType values to keep.
  • sort_by - <field>:ascending|descending sort expression.

Returns:

Every matching action summary.

Raises:

  • DocumentOperationError - If batch_size is not greater than 0, action_type holds an unknown value, or the Data Hub rejects a page.

action​

def action(*, action_id: str, table_limit: int = 10) -> ActionRecord | None

Fetch one action-history entry with its detail blocks.

Arguments:

  • action_id - Action identifier as reported by actions.
  • table_limit - Maximum rows per detail table.

Returns:

The action, or None when it does not exist.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

action_async​

async def action_async(*,
action_id: str,
table_limit: int = 10) -> ActionRecord | None

Asynchronously fetch one action-history entry with its detail blocks.

Arguments:

  • action_id - Action identifier as reported by actions.
  • table_limit - Maximum rows per detail table.

Returns:

The action, or None when it does not exist.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

field​

def field(field_name: str, *, version: int) -> FieldHistoryRecord | None

Return one field value from a specific historical version.

Arguments:

  • field_name - VI field name to inspect.
  • version - Historical version number.

Returns:

The field's historical value, or None when the version or field does not exist.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

field_async​

async def field_async(field_name: str, *,
version: int) -> FieldHistoryRecord | None

Asynchronously return one field value from a specific historical version.

Arguments:

  • field_name - VI field name to inspect.
  • version - Historical version number.

Returns:

The field's historical value, or None when the version or field does not exist.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

ChildHistoryManager Objects​

class ChildHistoryManager()

Bound helper for version and field history on one child document.

The Data Hub exposes child versions per parent version, so versions walks the parent's history and keeps the entries for this child. There is no actions() here: the spec declares no child action-history operation.

Arguments:

  • runtime - Child-document runtime bound to the current child snapshot.

versions​

def versions(*,
start: int = 0,
limit: int = 40) -> builtins.list[ChildVersionSummaryRecord]

List one page of the child document's version history.

Arguments:

  • start - Zero-based page offset.
  • limit - Maximum number of versions to return.

Returns:

Child version summaries.

Raises:

  • DocumentNotFoundError - If the parent document does not exist.
  • DocumentOperationError - If the Data Hub rejects a read.

versions_async​

async def versions_async(
*,
start: int = 0,
limit: int = 40) -> builtins.list[ChildVersionSummaryRecord]

Asynchronously list one page of the child document's version history.

Arguments:

  • start - Zero-based page offset.
  • limit - Maximum number of versions to return.

Returns:

Child version summaries.

Raises:

  • DocumentNotFoundError - If the parent document does not exist.
  • DocumentOperationError - If the Data Hub rejects a read.

versions_all​

def versions_all(
*,
batch_size: int = 40,
max_items: int | None = None
) -> builtins.list[ChildVersionSummaryRecord]

List the child document's whole version history.

Arguments:

  • batch_size - Accepted for signature parity with HistoryManager.versions_all and validated (must be greater than 0), but otherwise unused: the child history comes from one read of the parent's whole version list.
  • max_items - Optional ceiling on the number of versions returned.

Returns:

Every child version summary.

Raises:

  • DocumentNotFoundError - If the parent document does not exist.
  • DocumentOperationError - If batch_size is not greater than 0 or the Data Hub rejects a read.

versions_all_async​

async def versions_all_async(*,
batch_size: int = 40,
max_items: int | None = None
) -> builtins.list[ChildVersionSummaryRecord]

Asynchronously list the child document's whole version history.

Arguments:

  • batch_size - Accepted for signature parity with HistoryManager.versions_all and validated (must be greater than 0), but otherwise unused: the child history comes from one read of the parent's whole version list.
  • max_items - Optional ceiling on the number of versions returned.

Returns:

Every child version summary.

Raises:

  • DocumentNotFoundError - If the parent document does not exist.
  • DocumentOperationError - If batch_size is not greater than 0 or the Data Hub rejects a read.

version​

def version(*,
version: str | int,
changed_only: bool = False) -> ChildVersionRecord | None

Fetch the child document as it was under one parent version.

Arguments:

  • version - The parent document's version identifier. Take it from the parent_version of an entry returned by versions.
  • changed_only - Whether to return only the fields that changed.

Returns:

The child version, or None when the child did not exist under that parent version.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

version_async​

async def version_async(
*,
version: str | int,
changed_only: bool = False) -> ChildVersionRecord | None

Asynchronously fetch the child document under one parent version.

Arguments:

  • version - The parent document's version identifier.
  • changed_only - Whether to return only the fields that changed.

Returns:

The child version, or None when the child did not exist under that parent version.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

version_items​

def version_items(*,
version: str | int,
start: int = 0,
limit: int = 40) -> builtins.list[HistoryInfoRecord]

List the additional history entries for the child under one parent version.

Arguments:

  • version - The parent document's version identifier.
  • start - Zero-based page offset.
  • limit - Maximum number of entries to return.

Returns:

History entries; empty when there are none.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

version_items_async​

async def version_items_async(
*,
version: str | int,
start: int = 0,
limit: int = 40) -> builtins.list[HistoryInfoRecord]

Asynchronously list the additional history entries for one parent version.

Arguments:

  • version - The parent document's version identifier.
  • start - Zero-based page offset.
  • limit - Maximum number of entries to return.

Returns:

History entries; empty when there are none.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

field​

def field(field_name: str, *, version: int) -> FieldHistoryRecord | None

Return one child field value from a specific historical version.

Arguments:

  • field_name - Child field name to inspect.
  • version - Historical version number.

Returns:

The field's historical value, or None when the version or field does not exist.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

field_async​

async def field_async(field_name: str, *,
version: int) -> FieldHistoryRecord | None

Asynchronously return one child field value from a historical version.

Arguments:

  • field_name - Child field name to inspect.
  • version - Historical version number.

Returns:

The field's historical value, or None when the version or field does not exist.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

ChildImagesManager Objects​

class ChildImagesManager()

Bound helper for images on one child document.

Arguments:

  • runtime - Child-document runtime bound to the current child snapshot.

list​

def list() -> builtins.list[AttachmentRecord]

List the images on the current child document, whatever their category.

Returns:

One record per file of the child whose content type is an image.

Raises:

  • IncompleteListingError - If the service stopped advancing while the files were being listed.

list_async​

async def list_async() -> builtins.list[AttachmentRecord]

Asynchronously list the images on the current child document.

Returns:

One record per file of the child whose content type is an image.

Raises:

  • IncompleteListingError - If the service stopped advancing while the files were being listed.

get​

def get(*, attachment_id: AttachmentId) -> AttachmentRecord | None

Fetch one child image attachment by id.

Arguments:

  • attachment_id - Child image attachment identifier or UUID.

Returns:

The image record, or None when no image matches.

get_async​

async def get_async(*, attachment_id: AttachmentId) -> AttachmentRecord | None

Asynchronously fetch one child image attachment by id.

Arguments:

  • attachment_id - Child image attachment identifier or UUID.

Returns:

The image record, or None when no image matches.

download​

def download(*, attachment_id: AttachmentId) -> bytes

Download one child image attachment's binary content.

Arguments:

  • attachment_id - Child image attachment identifier or UUID.

Returns:

Raw image bytes.

Raises:

  • DocumentNotFoundError - If no image with that id is attached to the child.
  • DocumentOperationError - If the Data Hub refuses the read.

Notes:

The entire image is buffered in memory and returned as bytes; a child image has no streaming read.

download_async​

async def download_async(*, attachment_id: AttachmentId) -> bytes

Asynchronously download one child image attachment's binary content.

Arguments:

  • attachment_id - Child image attachment identifier or UUID.

Returns:

Raw image bytes.

Raises:

  • DocumentNotFoundError - If no image with that id is attached to the child.
  • DocumentOperationError - If the Data Hub refuses the read.

Notes:

The entire image is buffered in memory and returned as bytes; a child image has no streaming read.

upload​

def upload(*,
file: bytes | bytearray | str | builtins.object,
name: str | None = None,
content_type: str | None = None,
category: str | None = None,
description: str | None = None,
upload_folder_path: str | None = None,
upload_folder_uri: str | None = None) -> AttachmentRecord

Upload a new image attachment to the current child document.

Arguments:

  • file - Image contents as bytes, file path, or file-like object.
  • name - Optional display name. When omitted, the SDK infers it when possible.
  • content_type - Optional MIME type override.
  • category - Image category of the child's entity type, such as photo. The service refuses an unknown category.
  • description - Optional image description.
  • upload_folder_path - Optional managed-folder path used for staged uploads.
  • upload_folder_uri - Optional managed-folder URI override.

Returns:

The created image as an AttachmentRecord wrapper.

Raises:

  • DocumentOperationError - If the content type is not an image, the service refused the upload or the category, or it stored the image under a category other than category. In the last case the image stays attached.
  • DocumentNotFoundError - If the parent or the child no longer exists.

Notes:

A path or a file object is streamed in 256 KiB chunks, so memory use does not grow with the file; bytes are sent as they are. A file object is sent from its current position. The upload is a POST, which the default retry_methods leave out, so a failure mid-body is raised and the body is not resent.

upload_async​

async def upload_async(
*,
file: bytes | bytearray | str | builtins.object,
name: str | None = None,
content_type: str | None = None,
category: str | None = None,
description: str | None = None,
upload_folder_path: str | None = None,
upload_folder_uri: str | None = None) -> AttachmentRecord

Asynchronously upload a new image attachment to the current child document.

Arguments:

  • file - Image contents as bytes, file path, or file-like object.
  • name - Optional display name. When omitted, the SDK infers it when possible.
  • content_type - Optional MIME type override.
  • category - Image category of the child's entity type, such as photo. The service refuses an unknown category.
  • description - Optional image description.
  • upload_folder_path - Optional managed-folder path used for staged uploads.
  • upload_folder_uri - Optional managed-folder URI override.

Returns:

The created image as an AttachmentRecord wrapper.

Raises:

  • DocumentOperationError - If the content type is not an image, the service refused the upload or the category, or it stored the image under a category other than category. In the last case the image stays attached.
  • DocumentNotFoundError - If the parent or the child no longer exists.
  • DocumentConflictError - If the parent changed while the image was being attached.

Notes:

A path or a file object is streamed in 256 KiB chunks, each read on the event loop; bytes are sent as they are. The upload is a POST, which the default retry_methods leave out, so a failure mid-body is raised and the body is not resent. The image is attached by a locked write of the parent, as in upload. When the task is cancelled before the attach, the stored file is deleted, and that delete finishes even if the caller is cancelled again.

delete​

def delete(*, attachment_id: AttachmentId) -> None

Delete one child image attachment by id.

Arguments:

  • attachment_id - Child image attachment identifier or UUID.

Raises:

  • DocumentNotFoundError - If no image with that id is attached to the child.
  • DocumentConflictError - If the image changed since its version was read (412). The delete is not resent without If-Match; refresh the child and retry.
  • DocumentOperationError - If the Data Hub refuses the delete, or the image is still listed after it.

delete_async​

async def delete_async(*, attachment_id: AttachmentId) -> None

Asynchronously delete one child image attachment by id.

Arguments:

  • attachment_id - Child image attachment identifier or UUID.

Raises:

  • DocumentNotFoundError - If no image with that id is attached to the child.
  • DocumentConflictError - If the image changed since its version was read (412). The delete is not resent without If-Match; refresh the child and retry.
  • DocumentOperationError - If the Data Hub refuses the delete, or the image is still listed after it.

Payload normalization helpers for the document-domain feature layer.

Small pure functions that deep-copy values and coerce sheet- and insight-like inputs (generated models, handwritten entities, or mappings) into plain, mutable JSON payloads ready to send to the Data Hub API.

Request builders for document reads.

Pure functions that turn the list / list_all filter arguments and the get_many id list into Data Hub request bodies, and read an id-lookup page back. None of them sends a request, so each can be tested without a client.

Create, read, edit, and audit relationships between Data Hub documents.

Provides the RelationshipCreateInput and RelationshipLinkUpdate payload dataclasses and the DocumentRelationshipsService helper used by the documents feature layer to create typed relationships, query the relationship types valid between documents, edit a link, and read its version and action history.

RelationshipCreateInput Objects​

@dataclass(frozen=True)
class RelationshipCreateInput()

Curated relationship-create helper payload.

from_document​

to_document​

relationship​

field_values​

valid_from​

valid_to​

to_dict​

def to_dict() -> JsonObject

Return the create input as a normalized, JSON-serializable mapping.

Endpoint and datetime fields are normalized (document refs flattened, datetimes rendered to wire strings); use this for logging or previews.

Returns:

The relationship-create payload as plain Python types.

raw_dict​

def raw_dict() -> JsonObject

Return the exact wire payload resolved for this relationship.

Returns:

The generated relationship payload as plain Python types.

Raises:

  • DocumentOperationError - If the input has not yet been resolved to a concrete wire payload (call it via the service, which resolves the relationship type before sending).

RelationshipLinkUpdate Objects​

@dataclass(frozen=True, slots=True)
class RelationshipLinkUpdate()

Partial edit of a relationship link.

Every field defaults to None, meaning "leave unchanged". field_values are merged onto the link's existing values field by field. Clearing a validity bound is not expressible here; send a full payload through update(body=...) for that.

Arguments:

  • field_values - Relationship field values to set, keyed by field name.
  • valid_from - New validity start as a datetime or ISO-8601 string.
  • valid_to - New validity end as a datetime or ISO-8601 string.

field_values​

valid_from​

valid_to​

to_dict​

def to_dict() -> JsonObject

Return the update in constructor shape with datetimes rendered.

Returns:

The update as plain Python types, None for untouched fields.

raw_dict​

def raw_dict() -> JsonObject

Return the camelCase wire fragment this update merges onto the link.

Returns:

Only the fields being changed, in wire naming (fieldValues, validFrom, validTo).

is_empty​

def is_empty() -> bool

Return whether the update changes nothing.

DocumentRelationshipsService Objects​

class DocumentRelationshipsService()

Root helper for creating, discovering, editing, and auditing document relationships.

Links are addressed by id, mirroring attachments.get/delete. Edits go through PUT /links/{id} as a read-modify-write guarded by the link's ETag; there is no patch() because the generated PATCH binding is broken (see website/docs/Contributing/Upstream-Spec-Issues.md).

between​

def between(*, from_document: Any,
to_document: Any) -> list[RelationshipTypeRecord]

List relationship types valid between two documents.

Arguments:

  • from_document - Source document, a (type, id) tuple, or any object exposing document-like identifier attributes.
  • to_document - Target document reference in the same accepted forms.

Returns:

The relationship types whose endpoints support the two documents' types, in either direction.

Raises:

  • DocumentOperationError - If either argument cannot be normalized into a document reference.

between_async​

async def between_async(*, from_document: Any,
to_document: Any) -> list[RelationshipTypeRecord]

Asynchronously list relationship types valid between two documents.

Arguments:

  • from_document - Source document, a (type, id) tuple, or any object exposing document-like identifier attributes.
  • to_document - Target document reference in the same accepted forms.

Returns:

The relationship types whose endpoints support the two documents' types, in either direction.

Raises:

  • DocumentOperationError - If either argument cannot be normalized into a document reference.

for_types​

def for_types(*, from_type: str, to_type: str) -> list[RelationshipTypeRecord]

List relationship types valid between two document types.

Arguments:

  • from_type - Source document/entity type name.
  • to_type - Target document/entity type name.

Returns:

The relationship types whose endpoints support the pair of types in either direction.

for_types_async​

async def for_types_async(*, from_type: str,
to_type: str) -> list[RelationshipTypeRecord]

Asynchronously list relationship types valid between two document types.

Arguments:

  • from_type - Source document/entity type name.
  • to_type - Target document/entity type name.

Returns:

The relationship types whose endpoints support the pair of types in either direction.

create​

def create(*,
from_document: Any,
to_document: Any,
relationship: str | None = None,
field_values: Any | None = None,
valid_from: datetime | str | None = None,
valid_to: datetime | str | None = None) -> RelationshipLinkRecord

Create a relationship link between two documents.

Resolves the relationship type (inferring it when unambiguous), orients the endpoints to match the type's declared direction, and persists the link.

Arguments:

  • from_document - Source document, a (type, id) tuple, or any object exposing document-like identifier attributes.
  • to_document - Target document reference in the same accepted forms.
  • relationship - Relationship type name or qualified name. Optional when exactly one type is valid between the two document types.
  • field_values - Optional mapping-like payload of relationship field values.
  • valid_from - Optional validity start as a datetime or ISO-8601 string.
  • valid_to - Optional validity end as a datetime or ISO-8601 string.

Returns:

The created relationship link.

Raises:

  • DocumentOperationError - If a document reference cannot be normalized, the relationship type is missing, ambiguous, or unsupported for the endpoints, or field_values is not mapping-like.
  • MalformedResponseError - If the create was accepted but the answer names no link. The link may have been created.

create_async​

async def create_async(
*,
from_document: Any,
to_document: Any,
relationship: str | None = None,
field_values: Any | None = None,
valid_from: datetime | str | None = None,
valid_to: datetime | str | None = None) -> RelationshipLinkRecord

Asynchronously create a relationship link between two documents.

Arguments:

  • from_document - Source document, a (type, id) tuple, or any object exposing document-like identifier attributes.
  • to_document - Target document reference in the same accepted forms.
  • relationship - Relationship type name or qualified name. Optional when exactly one type is valid between the two document types.
  • field_values - Optional mapping-like payload of relationship field values.
  • valid_from - Optional validity start as a datetime or ISO-8601 string.
  • valid_to - Optional validity end as a datetime or ISO-8601 string.

Returns:

The created relationship link.

Raises:

  • DocumentOperationError - If a document reference cannot be normalized, the relationship type is missing, ambiguous, or unsupported for the endpoints, or field_values is not mapping-like.
  • MalformedResponseError - If the create was accepted but the answer names no link. The link may have been created.

get​

def get(*, relationship_link_id: str) -> RelationshipLinkRecord | None

Fetch one relationship link by id.

Arguments:

  • relationship_link_id - Relationship-link identifier.

Returns:

The link record, or None when no link has that id.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

get_async​

async def get_async(
*, relationship_link_id: str) -> RelationshipLinkRecord | None

Asynchronously fetch one relationship link by id.

Arguments:

  • relationship_link_id - Relationship-link identifier.

Returns:

The link record, or None when no link has that id.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

update​

def update(*,
relationship_link_id: str,
changes: RelationshipLinkUpdate | None = None,
field_values: Mapping[str, Any] | None = None,
valid_from: datetime | str | None = None,
valid_to: datetime | str | None = None,
body: Any | None = None,
if_match: str | None = None) -> RelationshipLinkRecord

Edit a relationship link's field values or validity window.

Reads the current link and its ETag, merges the requested changes onto it, and sends the result back with If-Match so a concurrent edit fails with DocumentConflictError instead of being overwritten. When the server returns no ETag the update is sent without a precondition and a WARNING is logged.

valid_from / valid_to only persist on relationship types that define a validity window; on other types the server accepts the PUT (the link's version still increments) and drops the bounds silently (live-verified 2026-09-13). Read the link back if you need to confirm.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • changes - Typed partial update. Mutually exclusive with the loose keyword arguments and with body.
  • field_values - Field values to merge onto the link's existing values.
  • valid_from - New validity start (None leaves it unchanged).
  • valid_to - New validity end (None leaves it unchanged).
  • body - Advanced escape hatch: a full RelationshipLink model or wire-shaped dict sent as-is. Required to clear a validity bound. Pass the ETag you read it with as if_match: without it the precondition comes from a fresh read, so edits made since you built body are overwritten (a WARNING is logged).
  • if_match - ETag of the link as the caller last read it (for example from client.api.datahub.get_relationship_link_detailed). Sent as If-Match instead of the ETag of the fresh read, so a link changed since then fails with 412.

Returns:

The updated relationship link.

Raises:

  • DocumentOperationError - If body is combined with structured arguments, changes is combined with loose arguments, the update is empty, or the server answers 428 (precondition required) because no ETag could be read.
  • DocumentNotFoundError - If no link has that id.
  • DocumentConflictError - If the link changed since it was read (412).

update_async​

async def update_async(*,
relationship_link_id: str,
changes: RelationshipLinkUpdate | None = None,
field_values: Mapping[str, Any] | None = None,
valid_from: datetime | str | None = None,
valid_to: datetime | str | None = None,
body: Any | None = None,
if_match: str | None = None) -> RelationshipLinkRecord

Asynchronously edit a relationship link's field values or validity window.

See update for the ETag and validity-window semantics.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • changes - Typed partial update. Mutually exclusive with the loose keyword arguments and with body.
  • field_values - Field values to merge onto the link's existing values.
  • valid_from - New validity start (None leaves it unchanged).
  • valid_to - New validity end (None leaves it unchanged).
  • body - Advanced escape hatch: a full RelationshipLink model or wire-shaped dict sent as-is; pair it with if_match.
  • if_match - ETag of the link as the caller last read it, sent as If-Match instead of the ETag of the fresh read.

Returns:

The updated relationship link.

Raises:

  • DocumentOperationError - If body is combined with structured arguments, changes is combined with loose arguments, the update is empty, or the server answers 428.
  • DocumentNotFoundError - If no link has that id.
  • DocumentConflictError - If the link changed since it was read (412).

remove​

def remove(*, relationship_link_id: str) -> None

Remove one relationship link by id.

Removing a link detaches the two documents; the documents themselves are left intact.

Arguments:

  • relationship_link_id - Relationship-link identifier.

Raises:

  • DocumentNotFoundError - If no link has that id.

remove_async​

async def remove_async(*, relationship_link_id: str) -> None

Asynchronously remove one relationship link by id.

Arguments:

  • relationship_link_id - Relationship-link identifier.

Raises:

  • DocumentNotFoundError - If no link has that id.

versions​

def versions(*,
relationship_link_id: str,
start: int = 0,
limit: int = 40) -> list[VersionSummaryRecord]

List one page of a link's version history.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • start - Zero-based page offset.
  • limit - Maximum number of versions to return.

Returns:

Version summaries, newest first; empty when the link has none.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

versions_async​

async def versions_async(*,
relationship_link_id: str,
start: int = 0,
limit: int = 40) -> list[VersionSummaryRecord]

Asynchronously list one page of a link's version history.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • start - Zero-based page offset.
  • limit - Maximum number of versions to return.

Returns:

Version summaries, newest first; empty when the link has none.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

versions_all​

def versions_all(*,
relationship_link_id: str,
batch_size: int = 40,
max_items: int | None = None) -> list[VersionSummaryRecord]

List a link's whole version history, paging until exhausted.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • batch_size - Page size per request; must be greater than 0.
  • max_items - Optional ceiling on the number of versions returned.

Returns:

Every version summary, newest first.

Raises:

  • DocumentOperationError - If batch_size is not greater than 0 or the Data Hub rejects a page.

versions_all_async​

async def versions_all_async(
*,
relationship_link_id: str,
batch_size: int = 40,
max_items: int | None = None) -> list[VersionSummaryRecord]

Asynchronously list a link's whole version history.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • batch_size - Page size per request; must be greater than 0.
  • max_items - Optional ceiling on the number of versions returned.

Returns:

Every version summary, newest first.

Raises:

  • DocumentOperationError - If batch_size is not greater than 0 or the Data Hub rejects a page.

version​

def version(*,
relationship_link_id: str,
version: str | int,
changed_only: bool = False) -> VersionRecord | None

Fetch one historical version of a link with its field values.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • version - Version identifier as reported by versions.
  • changed_only - Whether to return only the fields that changed.

Returns:

The version, or None when the link or version does not exist.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

version_async​

async def version_async(*,
relationship_link_id: str,
version: str | int,
changed_only: bool = False) -> VersionRecord | None

Asynchronously fetch one historical version of a link.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • version - Version identifier as reported by versions.
  • changed_only - Whether to return only the fields that changed.

Returns:

The version, or None when the link or version does not exist.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

actions​

def actions(
*,
relationship_link_id: str,
start: int = 0,
limit: int = 10,
action_type: ActionType | Sequence[ActionType] | None = None,
sort_by: str = "createdAt:descending") -> list[ActionSummaryRecord]

List one page of a link's action history.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • start - Zero-based page offset.
  • limit - Maximum number of actions to return.
  • action_type - One or more sasvi.types.ActionType values to keep.
  • sort_by - <field>:ascending|descending sort expression.

Returns:

Action summaries; empty when the link has none.

Raises:

  • DocumentOperationError - If action_type holds an unknown value or the Data Hub rejects the read.

actions_async​

async def actions_async(
*,
relationship_link_id: str,
start: int = 0,
limit: int = 10,
action_type: ActionType | Sequence[ActionType] | None = None,
sort_by: str = "createdAt:descending") -> list[ActionSummaryRecord]

Asynchronously list one page of a link's action history.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • start - Zero-based page offset.
  • limit - Maximum number of actions to return.
  • action_type - One or more sasvi.types.ActionType values to keep.
  • sort_by - <field>:ascending|descending sort expression.

Returns:

Action summaries; empty when the link has none.

Raises:

  • DocumentOperationError - If action_type holds an unknown value or the Data Hub rejects the read.

actions_all​

def actions_all(
*,
relationship_link_id: str,
batch_size: int = 50,
max_items: int | None = None,
action_type: ActionType | Sequence[ActionType] | None = None,
sort_by: str = "createdAt:descending") -> list[ActionSummaryRecord]

List a link's whole action history, paging until exhausted.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • batch_size - Page size per request; must be greater than 0.
  • max_items - Optional ceiling on the number of actions returned.
  • action_type - One or more sasvi.types.ActionType values to keep.
  • sort_by - <field>:ascending|descending sort expression.

Returns:

Every matching action summary.

Raises:

  • DocumentOperationError - If batch_size is not greater than 0, action_type holds an unknown value, or the Data Hub rejects a page.

actions_all_async​

async def actions_all_async(
*,
relationship_link_id: str,
batch_size: int = 50,
max_items: int | None = None,
action_type: ActionType | Sequence[ActionType] | None = None,
sort_by: str = "createdAt:descending") -> list[ActionSummaryRecord]

Asynchronously list a link's whole action history.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • batch_size - Page size per request; must be greater than 0.
  • max_items - Optional ceiling on the number of actions returned.
  • action_type - One or more sasvi.types.ActionType values to keep.
  • sort_by - <field>:ascending|descending sort expression.

Returns:

Every matching action summary.

Raises:

  • DocumentOperationError - If batch_size is not greater than 0, action_type holds an unknown value, or the Data Hub rejects a page.

action​

def action(*, relationship_link_id: str,
action_id: str) -> ActionRecord | None

Fetch one action-history entry of a link with its detail blocks.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • action_id - Action identifier as reported by actions.

Returns:

The action, or None when the link or action does not exist.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

action_async​

async def action_async(*, relationship_link_id: str,
action_id: str) -> ActionRecord | None

Asynchronously fetch one action-history entry of a link.

Arguments:

  • relationship_link_id - Relationship-link identifier.
  • action_id - Action identifier as reported by actions.

Returns:

The action, or None when the link or action does not exist.

Raises:

  • DocumentOperationError - If the Data Hub rejects the read.

Result wrappers for document-domain manager methods.

Comment, attachment, and relationship managers used to leak raw openapi-generated models, which type every field X | Unset. That kills IDE autocomplete and produces ugly reprs in notebooks. These handwritten wrappers expose the same data with clean X | None field types and a .raw escape hatch back to the generated model.

Pattern matches sasvi.search.results.Vertex / Edge etc. Every wrapper has:

  • per-field @property accessors returning X | None
  • .raw typed escape hatch
  • .to_dict() JSON-serializable snapshot
  • readable __repr__

CommentRecord Objects​

class CommentRecord()

Normalized comment record returned by Document.comments.list().

raw​

@property
def raw() -> _GeneratedComment

The underlying generated SAS Comment model.

id​

@property
def id() -> int | None

Numeric identifier of the comment within the document.

category​

@property
def category() -> str | None

Comment category (e.g. "GENERAL").

author​

@property
def author() -> CommentUser | None

User who authored the comment.

author_name​

@property
def author_name() -> str | None

Display name of the comment's author (None when unknown).

author_id​

@property
def author_id() -> str | None

Identifier of the comment's author (None when unknown).

create_date​

@property
def create_date() -> _datetime.datetime | None

Timestamp when the comment was created.

last_updated_at​

@property
def last_updated_at() -> _datetime.datetime | None

Timestamp when the comment was last edited.

last_updated_by​

@property
def last_updated_by() -> str | None

User who last edited the comment.

detail​

@property
def detail() -> str | None

The comment's text body.

to_dict​

def to_dict() -> JsonObject

Return a JSON-serializable snapshot of the comment.

AttachmentRecord Objects​

class AttachmentRecord()

Normalized attachment record returned by Document.attachments.list().

raw​

@property
def raw() -> _GeneratedAttachmentFile

The underlying generated SAS File model.

id​

@property
def id() -> UUID | None

Unique identifier of the attachment file.

name​

@property
def name() -> str | None

Current display name of the attachment.

original_name​

@property
def original_name() -> str | None

Original file name captured when the attachment was uploaded.

category​

@property
def category() -> str | None

VI file category assigned to the attachment.

location​

@property
def location() -> str | None

Storage location (managed-folder path/URI) of the attachment.

type_name​

@property
def type_name() -> str | None

Attachment type (generated model calls this type_).

size​

@property
def size() -> int | None

Size of the attachment content in bytes.

description​

@property
def description() -> str | None

Free-text description of the attachment.

properties​

@property
def properties() -> FileProperties | None

Additional file metadata properties.

properties_dict​

def properties_dict() -> dict[str, object]

Return the file metadata properties as a plain dictionary.

Returns:

The properties payload converted to built-in Python types, or an empty dictionary when the attachment carries none.

@property
def links() -> list[SasLink]

Hypermedia links for the attachment (empty when none).

to_dict​

def to_dict() -> JsonObject

Return a JSON-serializable snapshot of the attachment.

RelationshipLinkRecord Objects​

class RelationshipLinkRecord()

Normalized relationship-link record returned by Document.relationships.

raw​

@property
def raw() -> _GeneratedRelationshipLink

The underlying generated SAS RelationshipLink model.

id​

@property
def id() -> str | None

Unique identifier of the relationship link.

relationship_type_name​

@property
def relationship_type_name() -> str | None

Name of the relationship type this link instantiates.

relationship_type_version​

@property
def relationship_type_version() -> int | None

Schema version of the relationship type.

relationship_type_label​

@property
def relationship_type_label() -> str | None

Human-readable label of the relationship type.

qualified_type_name​

@property
def qualified_type_name() -> str | None

Fully qualified relationship type name.

from_object_type_name​

@property
def from_object_type_name() -> str | None

Entity type name of the link's source document.

from_object_type_version​

@property
def from_object_type_version() -> int | None

Schema version of the source document's entity type.

from_object_id​

@property
def from_object_id() -> str | None

Document identifier of the link's source object.

from_object_display_label​

@property
def from_object_display_label() -> str | None

Display label of the link's source document.

to_object_type_name​

@property
def to_object_type_name() -> str | None

Entity type name of the link's target document.

to_object_type_version​

@property
def to_object_type_version() -> int | None

Schema version of the target document's entity type.

to_object_id​

@property
def to_object_id() -> str | None

Document identifier of the link's target object.

to_object_display_label​

@property
def to_object_display_label() -> str | None

Display label of the link's target document.

valid_from​

@property
def valid_from() -> _datetime.datetime | None

Start of the link's validity interval.

valid_to​

@property
def valid_to() -> _datetime.datetime | None

End of the link's validity interval.

field_values​

@property
def field_values() -> RelationshipLinkFieldValues | None

Custom field values carried on the relationship link.

field_values_dict​

def field_values_dict() -> dict[str, object]

Return the link's custom field values as a plain dictionary.

Returns:

Field values keyed by relationship field name, converted to built-in Python types; empty when the link carries none.

other_end​

def other_end(document_type: str, document_id: str) -> tuple[str, str] | None

Return the endpoint opposite to the given document.

Arguments:

  • document_type - Entity type name of the document you hold.
  • document_id - Identifier of the document you hold.

Returns:

(type_name, document_id) of the other endpoint, or None when the given document is not an endpoint of this link or the opposite endpoint is incomplete.

restricted_fields​

@property
def restricted_fields() -> RestrictedFields | None

Fields on the link the caller is not authorized to read.

created_at​

@property
def created_at() -> _datetime.datetime | None

Timestamp when the relationship link was created.

last_updated_at​

@property
def last_updated_at() -> _datetime.datetime | None

Timestamp when the relationship link was last updated.

type_name​

@property
def type_name() -> str | None

SAND-side flat link type (generated model calls this type_).

to_dict​

def to_dict() -> JsonObject

Return a JSON-serializable snapshot of the relationship link.

SheetRecord Objects​

class SheetRecord()

Normalized sheet record returned by sheet-listing methods.

raw​

@property
def raw() -> _GeneratedSheet

The underlying generated SAS Sheet model.

id​

@property
def id() -> int | None

Numeric identifier of the sheet.

name​

@property
def name() -> str | None

Display name of the sheet tab.

tab_order​

@property
def tab_order() -> int | None

Ordinal position of the sheet among the document's tabs.

sheet_type​

@property
def sheet_type() -> SheetType | None

Generated model calls this type_.

cells​

@property
def cells() -> list[SheetCell]

Cells laid out on the sheet (empty when none).

last_modified​

@property
def last_modified() -> _datetime.datetime | None

Timestamp when the sheet was last modified.

to_dict​

def to_dict() -> JsonObject

Return a JSON-serializable snapshot of the sheet.

VersionValueRecord Objects​

class VersionValueRecord(RawBackedHandle)

One field's value in a historical version, with its previous value.

raw​

@property
def raw() -> _GeneratedVersionValue

The underlying generated SAS VersionValue model.

name​

@property
def name() -> str | None

VI field name.

label​

@property
def label() -> str | None

Display label of the field.

value​

@property
def value() -> object | None

Field value at this version, as plain Python data.

previous_value​

@property
def previous_value() -> object | None

Field value at the preceding version, as plain Python data.

value_type​

@property
def value_type() -> str | None

Field data type reported by the server (generated model calls it type_).

changed​

@property
def changed() -> bool

Whether the value differs from the preceding version.

masked​

@property
def masked() -> bool

Whether the value is masked for the calling user.

to_dict​

def to_dict() -> JsonObject

Return a JSON-serializable snapshot without the field-restriction noise.

VersionSummaryRecord Objects​

class VersionSummaryRecord(_VersionFieldsMixin)

One entry of a document's or link's version history.

raw​

@property
def raw() -> _GeneratedVersionSummary

The underlying generated SAS VersionSummary model.

to_dict​

def to_dict() -> JsonObject

Return a JSON-serializable snapshot without hypermedia links.

VersionRecord Objects​

class VersionRecord(_VersionFieldsMixin, _VersionValuesMixin)

One full historical version of a document or link, with field values.

raw​

@property
def raw() -> _GeneratedVersion

The underlying generated SAS Version model.

to_dict​

def to_dict() -> JsonObject

Return a JSON-serializable snapshot without hypermedia links.

ChildVersionSummaryRecord Objects​

class ChildVersionSummaryRecord(_ChildVersionFieldsMixin)

One entry of a child document's version history.

raw​

@property
def raw() -> _GeneratedChildVersionSummary

The underlying generated SAS ChildVersionSummary model.

to_dict​

def to_dict() -> JsonObject

Return a JSON-serializable snapshot without hypermedia links.

ChildVersionRecord Objects​

class ChildVersionRecord(_ChildVersionFieldsMixin, _VersionValuesMixin)

One full historical version of a child document, with field values.

raw​

@property
def raw() -> _GeneratedChildVersion

The underlying generated SAS ChildVersion model.

to_dict​

def to_dict() -> JsonObject

Return a JSON-serializable snapshot without hypermedia links.

HistoryInfoRecord Objects​

class HistoryInfoRecord(RawBackedHandle)

Additional history information attached to one document version.

Records that a related item (an insight, a workspace, a file) changed as part of the version rather than a field of the document itself.

raw​

@property
def raw() -> Historyinfo

The underlying generated SAS Historyinfo model.

history_info_id​

@property
def history_info_id() -> int | None

Identifier of this history entry.

item_ref_id​

@property
def item_ref_id() -> str | None

Identifier of the related item that changed.

item_type​

@property
def item_type() -> str | None

Kind of related item that changed (for example a sheet type).

item_label​

@property
def item_label() -> str | None

Display label of the related item.

operation​

@property
def operation() -> str | None

Operation applied to the related item; see sasvi.types.VersionOperation.

owner_type​

@property
def owner_type() -> str | None

Entity type name of the owning document.

owner_id​

@property
def owner_id() -> str | None

Identifier of the owning document.

owner_version​

@property
def owner_version() -> str | None

Version of the owning document this entry belongs to.

to_dict​

def to_dict() -> JsonObject

Return a JSON-serializable snapshot of the history entry.

ActionSummaryRecord Objects​

class ActionSummaryRecord(_ActionFieldsMixin)

One entry of a document's or link's action history.

raw​

@property
def raw() -> _GeneratedActionSummary

The underlying generated SAS ActionSummary model.

to_dict​

def to_dict() -> JsonObject

Return a JSON-serializable snapshot without links and payload version.

ActionItemRecord Objects​

class ActionItemRecord(RawBackedHandle)

One detail block of a full action (a table of changed values, for example).

The server declares no schema for these blocks beyond a @type discriminator, so the record exposes the discriminator and label and hands the rest over through to_dict. Records compare by identity.

raw​

@property
def raw() -> ActionItemsItem

The underlying generated SAS ActionItemsItem model.

kind​

@property
def kind() -> str | None

The block's @type discriminator (for example "tableItem").

label​

@property
def label() -> str | None

Display label of the block, when the server provides one.

to_dict​

def to_dict() -> JsonObject

Return the whole block as JSON-serializable data.

ActionRecord Objects​

class ActionRecord(_ActionFieldsMixin)

One full action-history entry with its detail blocks.

raw​

@property
def raw() -> _GeneratedAction

The underlying generated SAS Action model.

items​

@property
def items() -> list[ActionItemRecord]

Detail blocks attached to the action (empty when none).

to_dict​

def to_dict() -> JsonObject

Return a JSON-serializable snapshot without links and payload version.

FieldHistoryRecord Objects​

class FieldHistoryRecord(RawBackedHandle)

One field's value at a specific historical version.

raw​

@property
def raw() -> _GeneratedFieldValue

The underlying generated SAS FieldValue model.

field_name​

@property
def field_name() -> str

VI field name the value belongs to.

value​

@property
def value() -> object | None

The historical value, as plain Python data (the wire key is raw).

version​

@property
def version() -> int

Historical version number the value was read from.

to_dict​

def to_dict() -> JsonObject

Return a JSON-serializable snapshot including the version number.

CommentCategoryRecord Objects​

class CommentCategoryRecord(RawBackedHandle)

Comment count for one category on a document.

raw​

@property
def raw() -> CommentCategorySummary

The underlying generated SAS CommentCategorySummary model.

category​

@property
def category() -> str | None

Comment category code (for example "GENERAL").

count​

@property
def count() -> int

Number of comments in the category (0 when unreported).

to_dict​

def to_dict() -> JsonObject

Return a JSON-serializable snapshot of the category count.

Public re-exports for child-document handles and their collection.

Public re-exports for the document handle and its collection.

Shared helpers for the documents feature layer.

Small utilities for payload normalization and filesystem/URL handling used by the document, child-document, and insight implementations.

ChildImageCreateInput Objects​

@dataclass(frozen=True, slots=True)
class ChildImageCreateInput()

Input model for creating child images during child creation.

file​

name​

content_type​

category​

description​

display_order​

to_dict​

def to_dict() -> JsonObject

Return a JSON-serializable snapshot of the input helper.

raw_dict​

def raw_dict() -> JsonObject

Return the UI-style file-operation body template before upload enrichment.

Insight handles and typed insight-cell wrappers.

Provides the InsightHandle facade over a document's insight sheet along with per-visualization cell handles (text, image, visualization, table, summary, map, timeline, network, and text-analytics) that expose their payload as typed, mutable properties.

SheetHandle Objects​

class SheetHandle(RawBackedHandle)

Bound handle for one document sheet, the base of insight and workspace handles.

Every edit is applied to the sheet as the service holds it when the SDK has the document lock, not to the copy the handle holds. refresh() reloads the copy. Attributes are not autosaved: use update(...) and the sheet helpers.

Arguments:

  • runtime - Document runtime that owns the sheet snapshot.
  • payload - Raw sheet payload.

id​

@property
def id() -> int | None

The sheet identifier, or None before the server assigned one.

name​

@property
def name() -> str | None

The sheet name shown on its tab, if set.

title​

@property
def title() -> str | None

The sheet title, if the payload carries one.

payload​

@property
def payload() -> JsonObject

A mutable deep copy of the raw sheet payload this handle holds.

raw_cells​

@property
def raw_cells() -> tuple[JsonObject, ...]

The raw cell payloads this handle holds, as copies in sheet order.

to_dict​

def to_dict() -> JsonObject

Return a normalized JSON-serializable snapshot of the sheet wrapper.

refresh​

def refresh() -> Self

Reload the sheet from the document and return this handle.

Raises:

  • DocumentOperationError - If the handle has no id or the sheet no longer exists.

delete​

def delete() -> None

Delete this sheet from the document.

Raises:

  • DocumentOperationError - If the handle has no id or the sheet no longer exists.

update​

def update(**changes: Any) -> Self

Persist sheet-level metadata changes and return the refreshed handle.

Only the named top-level keys are written. They are laid over the sheet as it is under the document lock, so cells a colleague saved since this handle was read are kept.

Arguments:

  • **changes - Top-level sheet fields to replace, such as name, tab_order, ux_state or theme. Snake-case names are translated to their wire names.

Returns:

This handle, holding the sheet as written.

Raises:

  • DocumentOperationError - If a change names a field the sheet does not support, the handle has no id, or the sheet no longer exists.

add_cell​

def add_cell(cell: InsightCell | dict[str, Any]) -> Self

Append one cell below the cells the sheet holds under the lock.

Arguments:

  • cell - Typed InsightCell model or raw cell payload.

Returns:

This handle, holding the sheet as written.

Raises:

  • DocumentOperationError - If the handle has no id or the sheet no longer exists.

remove_cell​

def remove_cell(cell_id: int) -> Self

Remove one cell by id.

Arguments:

  • cell_id - Identifier of the cell to remove.

Returns:

This handle, holding the sheet as written.

Raises:

  • DocumentOperationError - If the cell is not on the sheet under the lock, the handle has no id, or the sheet no longer exists.

move_cell​

def move_cell(cell_id: int, position: int) -> Self

Move one cell to a zero-based position in the rendered order.

The cells keep the row/position slots the sheet already has and fill them in the new order.

Arguments:

  • cell_id - Identifier of the cell to move.
  • position - Zero-based target position.

Returns:

This handle, holding the sheet as written.

Raises:

  • DocumentOperationError - If the cell is not on the sheet under the lock, the handle has no id, or the sheet no longer exists.

InsightCellHandle Objects​

class InsightCellHandle(RawBackedHandle)

Bound handle for one cell inside an insight sheet.

Arguments:

  • owner - Bound insight handle that owns the cell.
  • payload - Raw cell payload for the current cell snapshot.

row​

@property
def row() -> int | None

Zero-based grid row of the cell within the insight, if set.

position​

@property
def position() -> int | None

Ordinal position of the cell within its row, if set.

height​

@property
def height() -> int | None

Cell height in grid units, if set.

width​

@property
def width() -> int | None

Cell width in grid units, if set.

version​

@property
def version() -> int | None

Optimistic-concurrency version of the cell, if reported.

last_modified​

@property
def last_modified() -> str | None

ISO-8601 timestamp of the cell's last modification, if reported.

id​

@property
def id() -> int | None

Server-assigned identifier of the cell, if it has been persisted.

type​

@property
def type() -> str | None

VI cell type discriminator (for example "TEXT" or "VISUALIZATION").

visualization_type​

@property
def visualization_type() -> str | None

Visualization subtype for visualization cells, if applicable.

contents​

@property
def contents() -> object | None

Free-form cell contents, whose shape depends on the cell type.

payload​

@property
def payload() -> JsonObject

A mutable deep copy of the raw cell payload.

cell​

@property
def cell() -> InsightTypedCell

The payload parsed into the typed insight-cell model for this cell type.

refresh​

def refresh() -> InsightCellHandle

Reload this cell from the owning insight.

update​

def update(*,
cell: Mapping[str, Any] | BaseVIEntity | None = None,
**changes: Any) -> InsightCellHandle

Persist changes to this cell and return the refreshed handle.

Arguments:

  • cell - Optional replacement cell payload or handwritten InsightCell model.
  • **changes - Raw cell payload fields to replace.

Returns:

The refreshed typed cell handle.

remove​

def remove() -> None

Remove this cell from the owning insight.

to_dict​

def to_dict() -> JsonObject

Return a mutable copy of the current cell payload.

TextInsightCellHandle Objects​

class TextInsightCellHandle(InsightCellHandle)

Cell handle for a text (rich-text/markdown) insight cell.

cell​

@property
def cell() -> TextInsightCell

The payload parsed into the typed text-cell model.

contents​

@property
def contents() -> str | None

The cell's text body, if any.

ImageInsightCellHandle Objects​

class ImageInsightCellHandle(InsightCellHandle)

Cell handle for an image insight cell.

cell​

@property
def cell() -> ImageInsightCell

The payload parsed into the typed image-cell model.

VisualizationInsightCellHandle Objects​

class VisualizationInsightCellHandle(InsightCellHandle)

Cell handle for a data-visualization insight cell.

Base class for the concrete visualization handles (table, summary, map, timeline, network, text analytics) sharing the query/filter surface.

cell​

@property
def cell() -> VisualizationInsightCell

The payload parsed into the typed visualization-cell model.

documents​

@property
def documents() -> list[CellDocumentRef]

References to the source documents/entities the visualization queries.

filter_model​

@property
def filter_model() -> FilterModel | None

The filter applied to the visualization's data, if any.

results_per_page​

@property
def results_per_page() -> int | None

Page size requested for the visualization's results, if set.

visualization_options​

@property
def visualization_options() -> VisualizationOptions | None

Rendering options controlling how the visualization is displayed.

result​

@property
def result() -> object | None

The last computed visualization result payload, if present.

TableInsightCellHandle Objects​

class TableInsightCellHandle(VisualizationInsightCellHandle)

Visualization cell handle for a tabular insight cell.

cell​

@property
def cell() -> TableCell

The payload parsed into the typed table-cell model.

result​

@property
def result() -> TableVisualizationResult | None

The table visualization result wrapper, if computed.

table_result​

@property
def table_result() -> TableResult | None

The parsed table rows/columns result, if available.

SummaryInsightCellHandle Objects​

class SummaryInsightCellHandle(VisualizationInsightCellHandle)

Visualization cell handle for a summary (aggregate metrics) insight cell.

cell​

@property
def cell() -> SummaryCell

The payload parsed into the typed summary-cell model.

result​

@property
def result() -> SummaryVisualizationResult | None

The summary visualization result wrapper, if computed.

summary_result​

@property
def summary_result() -> SummaryResult | None

The parsed summary aggregation result, if available.

MapInsightCellHandle Objects​

class MapInsightCellHandle(VisualizationInsightCellHandle)

Visualization cell handle for a geospatial map insight cell.

cell​

@property
def cell() -> MapCell

The payload parsed into the typed map-cell model.

result​

@property
def result() -> MapVisualizationResult | None

The map visualization result wrapper, if computed.

map_result​

@property
def map_result() -> MapResult | None

The parsed map result (plotted features/points), if available.

initial_view​

@property
def initial_view() -> MapInitialView | None

The initial center/zoom the map opens with, if configured.

tile_provider​

@property
def tile_provider() -> str | None

Identifier of the base-map tile provider, if configured.

TimelineInsightCellHandle Objects​

class TimelineInsightCellHandle(VisualizationInsightCellHandle)

Visualization cell handle for a timeline insight cell.

cell​

@property
def cell() -> TimelineCell

The payload parsed into the typed timeline-cell model.

result​

@property
def result() -> TimelineVisualizationResult | None

The timeline visualization result wrapper, if computed.

timeline_result​

@property
def timeline_result() -> TimelineResult | None

The parsed timeline events result, if available.

timeline_view_range​

@property
def timeline_view_range() -> TimelineViewRange | None

The visible start/end time window of the timeline, if configured.

NetworkInsightCellHandle Objects​

class NetworkInsightCellHandle(VisualizationInsightCellHandle)

Visualization cell handle for a network (node-link graph) insight cell.

cell​

@property
def cell() -> NetworkCell

The payload parsed into the typed network-cell model.

result​

@property
def result() -> NetworkVisualizationResult | None

The network visualization result wrapper, if computed.

network_data​

@property
def network_data() -> InsightNetworkData | None

Raw network nodes/links payload for this cell.

nodes​

@property
def nodes() -> dict[str, InsightNetworkNode]

Mapping of node id to node model, or empty when no network data exists.

@property
def links() -> list[InsightNetworkLink]

List of link models, or empty when no network data exists.

zoom_level​

@property
def zoom_level() -> int | float | None

The graph zoom level, taken from the cell or falling back to the result.

TextAnalyticsInsightCellHandle Objects​

class TextAnalyticsInsightCellHandle(VisualizationInsightCellHandle)

Visualization cell handle for a text-analytics insight cell.

cell​

@property
def cell() -> TextAnalyticsCell

The payload parsed into the typed text-analytics-cell model.

result​

@property
def result() -> TextAnalyticsResult | None

The text-analytics result (extracted terms/entities), if computed.

InsightCellsManager Objects​

class InsightCellsManager()

Collection helper for cells within one bound insight.

Arguments:

  • owner - Bound insight handle that owns the cell collection.

list​

def list() -> builtins.list[InsightCellHandle]

List cells in the order the insight renders them (by row, then position).

get​

def get(*, cell_id: int) -> InsightCellHandle | None

Fetch one cell handle by id.

Arguments:

  • cell_id - Insight cell identifier.

Returns:

The typed cell handle, or None when it does not exist.

add_text​

def add_text(*,
contents: str,
row: int | None = None,
position: int | None = None,
height: int | None = None,
width: int | None = None,
**extra: Any) -> InsightCellHandle

Create a text cell from plain string contents.

Arguments:

  • contents - Cell text contents.
  • row - Optional grid row index.
  • position - Optional position within the row.
  • height - Optional cell height.
  • width - Optional cell width.
  • **extra - Additional raw cell payload properties.

Returns:

The created typed cell handle.

add_image​

def add_image(*,
contents: Any,
name: str | None = None,
content_type: str | None = None,
category: str | None = None,
description: str | None = None,
row: int | None = None,
position: int | None = None,
height: int | None = None,
width: int | None = None,
**extra: Any) -> InsightCellHandle

Create an image cell from an existing image payload or URL-like contents.

Arguments:

  • contents - Existing image payload, URL-like string, local image path, or image bytes.
  • name - Optional uploaded-image name when contents is uploaded in the background.
  • content_type - Optional uploaded-image MIME type when contents is uploaded.
  • category - Optional uploaded-image category.
  • description - Optional uploaded-image description.
  • row - Optional grid row index.
  • position - Optional position within the row.
  • height - Optional cell height.
  • width - Optional cell width.
  • **extra - Additional raw cell payload properties.

Returns:

The created typed cell handle.

add_table​

def add_table(*,
result: Mapping[str, Any] | BaseVIEntity | None = None,
row: int | None = None,
position: int | None = None,
height: int | None = None,
width: int | None = None,
**extra: Any) -> InsightCellHandle

Create a table cell from explicit cell parameters.

Arguments:

  • result - Optional explicit result payload.
  • row - Optional grid row index.
  • position - Optional position within the row.
  • height - Optional cell height.
  • width - Optional cell width.
  • **extra - Additional raw cell payload properties.

Returns:

The created typed cell handle.

add_table_from_documents​

def add_table_from_documents(*,
documents: Sequence[Any],
columns: Sequence[str | tuple[str, str]
| TableColumn],
result: Mapping[str, Any] | BaseVIEntity
| None = None,
row: int | None = None,
position: int | None = None,
height: int | None = None,
width: int | None = None,
**extra: Any) -> InsightCellHandle

Create a table cell from a document collection and column specs.

Arguments:

  • documents - Bound documents or document-like payloads.
  • columns - Field names, (field, label) tuples, or TableColumn specs.
  • result - Must remain None when deriving from documents.
  • row - Optional grid row index.
  • position - Optional position within the row.
  • height - Optional cell height.
  • width - Optional cell width.
  • **extra - Additional raw cell payload properties.

Returns:

The created typed cell handle.

add_summary​

def add_summary(*,
result: Mapping[str, Any] | BaseVIEntity | None = None,
row: int | None = None,
position: int | None = None,
height: int | None = None,
width: int | None = None,
**extra: Any) -> InsightCellHandle

Create a summary cell from explicit cell parameters.

Arguments:

  • result - Optional explicit result payload.
  • row - Optional grid row index.
  • position - Optional position within the row.
  • height - Optional cell height.
  • width - Optional cell width.
  • **extra - Additional raw cell payload properties.

Returns:

The created typed cell handle.

add_summary_from_documents​

def add_summary_from_documents(*,
documents: Sequence[Any],
fields: Sequence[str | tuple[str, str]
| SummaryFieldSpec],
result: Mapping[str, Any] | BaseVIEntity
| None = None,
row: int | None = None,
position: int | None = None,
height: int | None = None,
width: int | None = None,
**extra: Any) -> InsightCellHandle

Create a summary cell from documents and field specs.

Arguments:

  • documents - Bound documents or document-like payloads.
  • fields - Field names, (field, label) tuples, or SummaryFieldSpec specs.
  • result - Must remain None when deriving from documents.
  • row - Optional grid row index.
  • position - Optional position within the row.
  • height - Optional cell height.
  • width - Optional cell width.
  • **extra - Additional raw cell payload properties.

Returns:

The created typed cell handle.

add_map​

def add_map(*,
result: Mapping[str, Any] | BaseVIEntity | None = None,
row: int | None = None,
position: int | None = None,
height: int | None = None,
width: int | None = None,
**extra: Any) -> InsightCellHandle

Create a map cell from explicit map parameters.

Arguments:

  • result - Optional explicit result payload.
  • row - Optional grid row index.
  • position - Optional position within the row.
  • height - Optional cell height.
  • width - Optional cell width.
  • **extra - Additional raw cell payload properties.

Returns:

The created typed cell handle.

add_map_from_documents​

def add_map_from_documents(*,
documents: Sequence[Any],
latitude_field: str,
longitude_field: str,
label_field: str = "_label",
tile_provider: str = "SAS Open Street Map",
initial_view: Mapping[str, Any] | BaseVIEntity
| Sequence[Sequence[float]] | None = None,
zoom: int | float | None = None,
result: Mapping[str, Any] | BaseVIEntity
| None = None,
row: int | None = None,
position: int | None = None,
height: int | None = None,
width: int | None = None,
**extra: Any) -> InsightCellHandle

Create a map cell from document coordinates and label fields.

Arguments:

  • documents - Bound documents or document-like payloads.
  • latitude_field - Field holding latitude values.
  • longitude_field - Field holding longitude values.
  • label_field - Field used for map labels.
  • tile_provider - Tile provider name.
  • initial_view - Optional initial-view payload.
  • zoom - Optional zoom level override.
  • result - Must remain None when deriving from documents.
  • row - Optional grid row index.
  • position - Optional position within the row.
  • height - Optional cell height.
  • width - Optional cell width.
  • **extra - Additional raw cell payload properties.

Returns:

The created typed cell handle.

add_timeline​

def add_timeline(*,
result: Mapping[str, Any] | BaseVIEntity | None = None,
row: int | None = None,
position: int | None = None,
height: int | None = None,
width: int | None = None,
**extra: Any) -> InsightCellHandle

Create a timeline cell from explicit timeline parameters.

Arguments:

  • result - Optional explicit result payload.
  • row - Optional grid row index.
  • position - Optional position within the row.
  • height - Optional cell height.
  • width - Optional cell width.
  • **extra - Additional raw cell payload properties.

Returns:

The created typed cell handle.

add_timeline_from_documents​

def add_timeline_from_documents(*,
documents: Sequence[Any],
events: Sequence[str | tuple[str, str]
| TimelineEventSpec],
interval: str | None = None,
interval_count: int | None = None,
minimum_cluster_size: int | None = None,
order: TimelineOrder | BaseVIEntity
| Mapping[str, Any] | None = None,
padding_factor: int | float | None = None,
result: Mapping[str, Any] | BaseVIEntity
| None = None,
row: int | None = None,
position: int | None = None,
height: int | None = None,
width: int | None = None,
**extra: Any) -> InsightCellHandle

Create a timeline cell from documents and event specs.

Arguments:

  • documents - Bound documents or document-like payloads.
  • events - Event-field specs for the timeline.
  • interval - Optional timeline interval bucket.
  • interval_count - Optional interval bucket count.
  • minimum_cluster_size - Optional minimum cluster size.
  • order - Optional timeline ordering payload.
  • padding_factor - Optional timeline padding factor.
  • result - Must remain None when deriving from documents.
  • row - Optional grid row index.
  • position - Optional position within the row.
  • height - Optional cell height.
  • width - Optional cell width.
  • **extra - Additional raw cell payload properties.

Returns:

The created typed cell handle.

add_network​

def add_network(*,
contents: Any = None,
result: Mapping[str, Any] | BaseVIEntity | None = None,
row: int | None = None,
position: int | None = None,
height: int | None = None,
width: int | None = None,
**extra: Any) -> InsightCellHandle

Create a network cell from explicit network payload pieces.

Arguments:

  • contents - Optional freeform contents payload.
  • result - Optional explicit result payload.
  • row - Optional grid row index.
  • position - Optional position within the row.
  • height - Optional cell height.
  • width - Optional cell width.
  • **extra - Additional raw cell payload properties.

Returns:

The created typed cell handle.

add_network_from_documents​

def add_network_from_documents(
*,
documents: Sequence[Any],
links: Sequence[tuple[str, str] | NetworkLinkSpec | Mapping[str, Any]]
| None = None,
zoom_level: int | float = 1,
result: Mapping[str, Any] | BaseVIEntity | None = None,
row: int | None = None,
position: int | None = None,
height: int | None = None,
width: int | None = None,
**extra: Any) -> InsightCellHandle

Create a network cell from documents and inferred or explicit links.

Arguments:

  • documents - Bound documents or document-like payloads.
  • links - Optional network-link specs.
  • zoom_level - Initial zoom level.
  • result - Must remain None when deriving from documents.
  • row - Optional grid row index.
  • position - Optional position within the row.
  • height - Optional cell height.
  • width - Optional cell width.
  • **extra - Additional raw cell payload properties.

Returns:

The created typed cell handle.

add_text_analytics​

def add_text_analytics(*,
result: Mapping[str, Any] | BaseVIEntity | None = None,
row: int | None = None,
position: int | None = None,
height: int | None = None,
width: int | None = None,
**extra: Any) -> InsightCellHandle

Create a text-analytics cell from explicit parameters.

Arguments:

  • result - Optional explicit result payload.
  • row - Optional grid row index.
  • position - Optional position within the row.
  • height - Optional cell height.
  • width - Optional cell width.
  • **extra - Additional raw cell payload properties.

Returns:

The created typed cell handle.

update​

def update(*,
cell_id: int,
cell: Mapping[str, Any] | BaseVIEntity | None = None,
**changes: Any) -> InsightCellHandle

Update one existing cell by id.

Arguments:

  • cell_id - Insight cell identifier.
  • cell - Optional replacement cell payload or handwritten InsightCell model.
  • **changes - Raw cell payload fields to replace.

Returns:

The updated typed cell handle.

remove​

def remove(*, cell_id: int) -> None

Remove one cell by id.

Removing a cell detaches a sub-element from its insight sheet; use InsightsManager.delete to destroy the whole insight.

Arguments:

  • cell_id - Insight cell identifier.

Raises:

  • DocumentRuntimeError - If the cell is no longer on the sheet.

move​

def move(*, cell_id: int, position: int) -> InsightCellHandle

Move one cell to a zero-based position and return the moved handle.

The cells keep the row/position slots the sheet already has and fill them in the new order, so the rendered order follows the move and the grid keeps its shape.

Arguments:

  • cell_id - Insight cell identifier.
  • position - Zero-based target position in the rendered order.

Returns:

The moved typed cell handle.

InsightHandle Objects​

class InsightHandle(SheetHandle)

Bound handle for one insight sheet.

Arguments:

  • runtime - Document runtime that owns the sheet snapshot.
  • payload - Raw insight sheet payload.

cells​

to_text​

def to_text() -> str

Render the text-like contents of all cells as a plain-text string.

Symmetric with to_markdown and to_dict; the name makes clear that the value is returned (use print(insight.to_text()) to emit it).

to_markdown​

def to_markdown(*, include_cell_headings: bool = False) -> str

Render the insight as clean, structured markdown.

Arguments:

  • include_cell_headings - Whether to add explicit cell boundary headings.

Returns:

Markdown representation of the current insight.

InsightsManager Objects​

class InsightsManager()

Bound helper for insight sheets attached to one document.

list​

def list() -> builtins.list[InsightHandle]

List insight sheets attached to the document.

list_async​

async def list_async() -> builtins.list[InsightHandle]

Asynchronously list insight sheets attached to the document.

get​

def get(*, insight_id: int) -> InsightHandle | None

Fetch one insight sheet by id.

Arguments:

  • insight_id - Insight sheet identifier.

Returns:

The bound insight handle, or None when no sheet has that id or the sheet with that id is not an insight (NOTESHEET).

Raises:

  • DocumentOperationError - When Data Hub rejects the read.

get_async​

async def get_async(*, insight_id: int) -> InsightHandle | None

Asynchronously fetch one insight sheet by id.

Arguments:

  • insight_id - Insight sheet identifier.

Returns:

The bound insight handle, or None when no sheet has that id or the sheet with that id is not an insight (NOTESHEET).

Raises:

  • DocumentOperationError - When Data Hub rejects the read.

create​

def create(*,
name: str,
cells: Sequence[InsightCell | Mapping[str, Any]] | None = None,
ux_state: dict[str, Any] | None = None,
tab_order: int | None = None) -> InsightHandle

Create a new insight sheet for the document.

Arguments:

  • name - Insight sheet title.
  • cells - Initial cells, as InsightCell values or raw mappings. When omitted, the sheet starts with one text cell saying when it was created.
  • ux_state - UI layout state for the sheet. When omitted, the layout the VI UI uses for a new insight.
  • tab_order - Position of the new sheet among the document's tabs. When omitted, the server assigns one.

Returns:

The created insight handle.

Raises:

  • DocumentOperationError - When Data Hub rejects the write, or accepts it but the new sheet cannot be found afterwards.

create_async​

async def create_async(*,
name: str,
cells: Sequence[InsightCell | Mapping[str, Any]]
| None = None,
ux_state: dict[str, Any] | None = None,
tab_order: int | None = None) -> InsightHandle

Asynchronously create a new insight sheet for the document.

Arguments:

  • name - Insight sheet title.
  • cells - Initial cells, as InsightCell values or raw mappings. When omitted, the sheet starts with one text cell saying when it was created.
  • ux_state - UI layout state for the sheet. When omitted, the layout the VI UI uses for a new insight.
  • tab_order - Position of the new sheet among the document's tabs. When omitted, the server assigns one.

Returns:

The created insight handle.

Raises:

  • DocumentOperationError - When Data Hub rejects the write, or accepts it but the new sheet cannot be found afterwards.

update​

def update(*, insight_id: int, insight: InsightUpdate) -> InsightHandle

Update an existing insight sheet.

The top-level fields set on insight (name, ux_state, tab_order) are merged onto the sheet as it is under the document lock. cells, when given, replaces the whole cell list; the cells the sheet held are gone. To change single cells, use the handle's cells manager.

Arguments:

  • insight_id - Insight sheet identifier.
  • insight - The fields to change.

Returns:

The updated insight handle.

Raises:

  • DocumentOperationError - If the sheet does not exist or Data Hub rejects the write.

update_async​

async def update_async(*, insight_id: int,
insight: InsightUpdate) -> InsightHandle

Asynchronously update an existing insight sheet.

Top-level fields are merged onto the sheet under the lock; cells, when given, replaces the whole cell list. See update.

Arguments:

  • insight_id - Insight sheet identifier.
  • insight - The fields to change.

Returns:

The updated insight handle.

Raises:

  • DocumentOperationError - If the sheet does not exist or Data Hub rejects the write.

delete​

def delete(*, insight_id: int) -> None

Delete an insight sheet by id.

Arguments:

  • insight_id - Insight sheet identifier.

delete_async​

async def delete_async(*, insight_id: int) -> None

Asynchronously delete an insight sheet by id.

Arguments:

  • insight_id - Insight sheet identifier.

copy_from​

def copy_from(source: Document | tuple[str, str], *,
insight_ids: Sequence[int]) -> builtins.list[InsightHandle]

Copy insight sheets from another document onto this document.

Each id is verified to be an insight (NOTESHEET) of the source before anything is sent; copying a document onto itself is refused.

Arguments:

  • source - The document that owns the insights: a bound Document, a (type, id) tuple, or any object exposing document-like identifier attributes.
  • insight_ids - Identifiers of the source insights to copy.

Returns:

The newly created insight handles on this document, in tab order.

Raises:

  • DocumentOperationError - If insight_ids is empty, an id is not an insight of the source, the source is this document, or the document type is read-only.

copy_from_async​

async def copy_from_async(
source: Document | tuple[str, str], *,
insight_ids: Sequence[int]) -> builtins.list[InsightHandle]

Asynchronously copy insight sheets from another document onto this one.

Arguments:

  • source - The document that owns the insights: a bound Document, a (type, id) tuple, or any object exposing document-like identifier attributes.
  • insight_ids - Identifiers of the source insights to copy.

Returns:

The newly created insight handles on this document, in tab order.

Raises:

  • DocumentOperationError - If insight_ids is empty, an id is not an insight of the source, the source is this document, or the document type is read-only.

Public documents surface.

Re-exports the curated public handles, collections, and input types. Private helpers in sasvi.documents.helpers and sasvi.documents._* are intentionally not surfaced here.

Workspace sheet handles and their node/relationship wrappers.

Provides the WorkspaceHandle facade over a document's workspace sheet together with the WorkspaceNode and WorkspaceRelationship handles and the manager objects that create, style, and lay out them.

DocumentLookup​

Resolves (entity_type_name, document_id) to a bound document.

WorkspaceNode Objects​

class WorkspaceNode(RawBackedHandle)

Bound handle for one node inside a bound workspace.

Arguments:

  • owner - Bound workspace handle that owns the node.
  • payload - Raw workspace-node payload.

id​

@property
def id() -> str | None

Identifier of the node within the workspace, if assigned.

entity_type_name​

@property
def entity_type_name() -> str | None

VI entity type of the document this node represents, if known.

document_id​

@property
def document_id() -> str | None

Identifier of the document this node references, if resolvable.

label​

@property
def label() -> str | None

Display label of the node, preferring a user-defined override.

position​

@property
def position() -> JsonObject | None

Canvas position of the node as an {"x", "y"} mapping, if placed.

node_shape​

@property
def node_shape() -> str | None

Shape used to render the node (for example "circle"), if styled.

border_color​

@property
def border_color() -> str | None

Border color of the node, if styled.

border_width​

@property
def border_width() -> int | float | None

Border width of the node, if styled.

color​

@property
def color() -> str | None

Fill color of the node, if styled.

scale​

@property
def scale() -> int | float | None

Size-scaling factor applied to the node, if styled.

payload​

@property
def payload() -> JsonObject

A mutable deep copy of the raw node payload.

document​

@property
def document() -> Document | None

The bound document this node represents, or None if unresolvable.

get_document​

def get_document() -> Document | None

Resolve the node back to a bound document when possible.

style​

def style(*,
color: str | None = None,
border_color: str | None = None,
border_width: int | float | None = None,
node_shape: str | None = None,
scale: int | float | None = None) -> WorkspaceNode

Convenience helper for common node styling fields.

Some Visual Investigator versions accept node styling and drop it. The write is compared with the node as stored afterwards, and every field the server did not keep is named in a WARNING log record.

Arguments:

  • color - Optional fill color.
  • border_color - Optional border color.
  • border_width - Optional border width.
  • node_shape - Optional node-shape identifier.
  • scale - Optional scale multiplier.

Returns:

The updated workspace node, as the server stored it.

Raises:

  • DocumentOperationError - If the node has no id or no longer exists.

refresh​

def refresh() -> WorkspaceNode

Reload this node from the owning workspace.

update​

def update(**changes: Any) -> WorkspaceNode

Persist changes to this node and return the refreshed handle.

Some Visual Investigator versions accept node styling and custom labels and drop them. The write is compared with the node as stored afterwards, and every field the server did not keep is named in a WARNING log record; the returned node reflects what the server stored.

Arguments:

  • **changes - Raw node payload fields to replace. label, position, node_shape, border_color and border_width are translated to their wire names.

Returns:

The updated workspace node, as the server stored it.

Raises:

  • DocumentOperationError - If the node has no id, no longer exists, or a change names a field the node does not support.

to_dict​

def to_dict() -> JsonObject

Return a normalized JSON-serializable snapshot of the node wrapper.

WorkspaceRelationship Objects​

class WorkspaceRelationship(RawBackedHandle)

Bound handle for one relationship edge inside a workspace.

Arguments:

  • owner - Bound workspace handle that owns the relationship.
  • payload - Raw workspace-relationship payload.

id​

@property
def id() -> str | None

Identifier of the relationship edge, if assigned.

label​

@property
def label() -> str | None

Display label of the relationship edge, if set.

source_id​

@property
def source_id() -> str | None

Identifier of the node the edge originates from, if set.

target_id​

@property
def target_id() -> str | None

Identifier of the node the edge points to, if set.

is_custom​

@property
def is_custom() -> bool

True when this relationship was added through the UI custom-link flow.

styling​

@property
def styling() -> JsonObject

The edge's styling attributes (color, dash, width, arrow, visibility).

payload​

@property
def payload() -> JsonObject

A mutable deep copy of the raw relationship payload.

refresh​

def refresh() -> WorkspaceRelationship

Reload this relationship from the owning workspace.

update​

def update(**changes: Any) -> WorkspaceRelationship

Persist changes to this relationship and return the refreshed handle.

Arguments:

  • **changes - Raw relationship payload fields to replace.

Returns:

The updated workspace relationship.

to_dict​

def to_dict() -> JsonObject

Return a normalized JSON-serializable snapshot of the relationship wrapper.

WorkspaceNodesManager Objects​

class WorkspaceNodesManager()

Collection helper for workspace nodes.

Arguments:

  • owner - Bound workspace handle that owns the node collection.

list​

def list() -> builtins.list[WorkspaceNode]

List all nodes in the workspace.

get​

def get(*, node_id: str) -> WorkspaceNode | None

Fetch one workspace node by id.

Arguments:

  • node_id - Workspace node identifier.

Returns:

The bound node, or None when it does not exist.

add_entity​

def add_entity(*,
entity_type_name: str,
document_id: str,
label: str | None = None,
position: Any = None,
color: str | None = None,
shape: str | None = None,
node_shape: str | None = None,
border_color: str | None = None,
border_width: int | float | None = None,
scale: int | float | None = None,
visible: bool | None = None,
node_id: str | None = None,
**extra: Any) -> WorkspaceNode

Add one entity/document node to the workspace graph.

Arguments:

  • entity_type_name - VI entity type name for the node.
  • document_id - Document id for the node.
  • label - Optional display label override.
  • position - Optional (x, y) tuple or payload mapping.
  • color - Optional node color.
  • shape - Optional legacy graph shape field.
  • node_shape - Optional explicit node-shape field.
  • border_color - Optional border color.
  • border_width - Optional border width.
  • scale - Optional node scale multiplier.
  • visible - Optional visibility flag.
  • node_id - Optional custom id for non-network-data workspaces.
  • **extra - Additional raw graph payload fields.

Returns:

The created workspace node. If the document is already on the canvas, its node is updated with the arguments given and returned; with no arguments it is returned as it is and nothing is written.

Raises:

  • DocumentOperationError - If a custom node_id is given for a network workspace, an extra field conflicts with the node's identity, or the node could not be created.

add_document​

def add_document(document: Document,
*,
label: str | None = None,
position: Any = None,
color: str | None = None,
shape: str | None = None,
node_shape: str | None = None,
border_color: str | None = None,
border_width: int | float | None = None,
scale: int | float | None = None,
visible: bool | None = None,
**extra: Any) -> WorkspaceNode

Add an existing bound document as a workspace node.

Arguments:

  • document - Bound document to add.
  • label - Optional display label override.
  • position - Optional (x, y) tuple or payload mapping.
  • color - Optional node color.
  • shape - Optional legacy graph shape field.
  • node_shape - Optional explicit node-shape field.
  • border_color - Optional border color.
  • border_width - Optional border width.
  • scale - Optional node scale multiplier.
  • visible - Optional visibility flag.
  • **extra - Additional raw node payload fields.

Returns:

The created or existing workspace node.

add_relationship​

def add_relationship(*,
source_id: str,
target_id: str,
relationship_id: str | None = None,
label: str | None = None,
color: str | None = None,
visible: bool | None = None,
**extra: Any) -> WorkspaceRelationship

Create a workspace relationship between two existing node ids.

Arguments:

  • source_id - Source node id.
  • target_id - Target node id.
  • relationship_id - Optional explicit relationship id.
  • label - Optional display label.
  • color - Optional relationship color.
  • visible - Optional visibility flag.
  • **extra - Additional raw relationship payload fields.

Returns:

The created workspace relationship.

remove​

def remove(*, node_id: str) -> None

Remove a node and any connected relationships from the workspace.

The node, the edges that touch it and its documents entry are removed from the sheet as it is under the document lock, so a node or edge a colleague added since this handle was read is kept.

Arguments:

  • node_id - Workspace node identifier.

Raises:

  • DocumentRuntimeError - If the node is no longer on the sheet.

WorkspaceRelationshipsManager Objects​

class WorkspaceRelationshipsManager()

Collection helper for workspace relationships/edges.

Arguments:

  • owner - Bound workspace handle that owns the relationship collection.

list​

def list() -> builtins.list[WorkspaceRelationship]

List all relationships in the workspace.

get​

def get(*, relationship_id: str) -> WorkspaceRelationship | None

Fetch one workspace relationship by id.

Arguments:

  • relationship_id - Workspace relationship identifier.

Returns:

The bound relationship, or None when it does not exist.

add​

def add(*,
source_id: str,
target_id: str,
relationship_id: str | None = None,
label: str | None = None,
color: str | None = None,
dash_type: str | None = None,
width: int | float | None = None,
default_arrow_type: str | None = None,
visible: bool | None = None,
custom: bool | None = None,
user_added: bool | None = None,
**extra: Any) -> WorkspaceRelationship

Add a relationship edge between two workspace node ids.

Arguments:

  • source_id - Source node id.
  • target_id - Target node id.
  • relationship_id - Optional explicit relationship id.
  • label - Optional display label.
  • color - Optional relationship color.
  • dash_type - Optional line dash style such as "dotted".
  • width - Optional rendered link width.
  • default_arrow_type - Optional arrow marker type.
  • visible - Optional visibility flag.
  • custom - Whether to mark the edge as a UI-style custom link.
  • user_added - Optional UI flag indicating the edge was user-created.
  • **extra - Additional raw relationship payload fields.

Returns:

The created workspace relationship.

remove​

def remove(*, relationship_id: str) -> None

Remove one workspace relationship by id.

Arguments:

  • relationship_id - Workspace relationship identifier.

Raises:

  • DocumentRuntimeError - If the relationship is no longer on the sheet.

WorkspaceLayoutManager Objects​

class WorkspaceLayoutManager()

Helper for reading and updating a workspace layout payload.

Arguments:

  • owner - Bound workspace handle that owns the layout payload.

get​

def get() -> object | None

Return the current layout payload in its most useful Python form.

set​

def set(layout: object) -> WorkspaceHandle

Persist a replacement layout payload and return the workspace.

Arguments:

  • layout - Raw layout payload or layout string accepted by the worksheet.

Returns:

The updated workspace handle.

WorkspaceHandle Objects​

class WorkspaceHandle(SheetHandle)

Bound handle for one workspace sheet.

Arguments:

  • runtime - Document runtime that owns the sheet snapshot.
  • payload - Raw workspace sheet payload.

nodes​

relationships​

layout​

duplicate​

def duplicate(*, name: str) -> WorkspaceHandle

Create a new workspace by copying this workspace's sheet and cells.

The copy is taken from the workspace as the service stores it when the SDK holds the document lock, not from the payload this handle holds, so the stored nodes, links and positions are all carried over.

Arguments:

  • name - Name for the duplicated workspace.

Returns:

The newly created workspace handle.

Raises:

  • DocumentOperationError - If this workspace has no id or no longer exists on the document.

to_dict​

def to_dict() -> JsonObject

Return a normalized JSON-serializable snapshot of the workspace wrapper.

WorkspacesManager Objects​

class WorkspacesManager()

Bound helper for workspace sheets attached to one document.

Arguments:

  • runtime - Document runtime bound to the current document snapshot.

list​

def list() -> builtins.list[WorkspaceHandle]

List workspace sheets attached to the document.

list_async​

async def list_async() -> builtins.list[WorkspaceHandle]

Asynchronously list workspace sheets attached to the document.

get​

def get(*, workspace_id: int) -> WorkspaceHandle | None

Fetch one workspace sheet by id.

Arguments:

  • workspace_id - Workspace sheet identifier.

Returns:

The bound workspace handle, or None when it does not exist.

get_async​

async def get_async(*, workspace_id: int) -> WorkspaceHandle | None

Asynchronously fetch one workspace sheet by id.

Arguments:

  • workspace_id - Workspace sheet identifier.

Returns:

The bound workspace handle, or None when it does not exist.

create​

def create(*,
name: str,
cells: builtins.list[dict[str, Any]] | None = None,
tab_order: int | None = None,
**extra: Any) -> WorkspaceHandle

Create a new workspace sheet for the document.

Arguments:

  • name - Workspace name.
  • cells - Optional initial worksheet cell payloads.
  • tab_order - Optional tab-order value.
  • **extra - Additional worksheet payload fields.

Returns:

The created workspace handle.

create_async​

async def create_async(*,
name: str,
cells: builtins.list[dict[str, Any]] | None = None,
tab_order: int | None = None,
**extra: Any) -> WorkspaceHandle

Asynchronously create a new workspace sheet for the document.

Arguments:

  • name - Workspace name.
  • cells - Optional initial worksheet cell payloads.
  • tab_order - Optional tab-order value.
  • **extra - Additional worksheet payload fields.

Returns:

The created workspace handle.

delete​

def delete(*, workspace_id: int) -> None

Delete a workspace sheet by id.

Arguments:

  • workspace_id - Workspace sheet identifier.

delete_async​

async def delete_async(*, workspace_id: int) -> None

Asynchronously delete a workspace sheet by id.

Arguments:

  • workspace_id - Workspace sheet identifier.

copy_from​

def copy_from(source: Document | tuple[str, str], *,
workspace_ids: Sequence[int]) -> builtins.list[WorkspaceHandle]

Copy workspace sheets from another document onto this document.

Each id is verified to be a workspace (WORKSHEET) of the source before anything is sent; copying a document onto itself is refused.

Arguments:

  • source - The document that owns the workspaces: a bound Document, a (type, id) tuple, or any object exposing document-like identifier attributes.
  • workspace_ids - Identifiers of the source workspaces to copy.

Returns:

The newly created workspace handles on this document, in tab order.

Raises:

  • DocumentOperationError - If workspace_ids is empty, an id is not a workspace of the source, the source is this document, or the document type is read-only.

copy_from_async​

async def copy_from_async(
source: Document | tuple[str, str], *,
workspace_ids: Sequence[int]) -> builtins.list[WorkspaceHandle]

Asynchronously copy workspace sheets from another document onto this one.

Arguments:

  • source - The document that owns the workspaces: a bound Document, a (type, id) tuple, or any object exposing document-like identifier attributes.
  • workspace_ids - Identifiers of the source workspaces to copy.

Returns:

The newly created workspace handles on this document, in tab order.

Raises:

  • DocumentOperationError - If workspace_ids is empty, an id is not a workspace of the source, the source is this document, or the document type is read-only.