sasvi.entities
Public surface for the entities feature layer.
Re-exports BaseVIEntity, the shared Pydantic base for VI entity
models, and EntityMetadataFacade, the read handle for entity-type
metadata, so callers can import them from sasvi.entities.
Shared Pydantic base for handwritten Visual Investigator entity models.
BaseVIEntity Objects
class BaseVIEntity(BaseModel)
Base model for handwritten Visual Investigator payload helpers.
The handwritten layer uses these models to give common VI JSON payloads a stable Python shape with validation and alias-aware serialization.
model_config
from_vi_dict
@classmethod
def from_vi_dict(cls: type[EntityModelT],
payload: Mapping[str, Any] | BaseVIEntity) -> EntityModelT
Validate and coerce a Visual Investigator-style payload.
Arguments:
payload- Mapping or model instance using VI field names or aliases.
Returns:
A validated instance of cls.
to_vi_dict
def to_vi_dict() -> JsonObject
Serialize the model using Visual Investigator field aliases.
Read-only facade over Data Hub entity-type metadata.
EntityMetadataFacade Objects
class EntityMetadataFacade()
Thin metadata facade over Data Hub stored-object operations.
Arguments:
datahub_api- Generated Data Hub API namespace used for metadata calls.
list_entity_types
def list_entity_types(*,
exclude_unauthorized: bool = False) -> list[EntityType]
List entity-type stored objects.
Arguments:
exclude_unauthorized- Whether unauthorized entity types should be omitted.
Returns:
Generated entity-type payloads.
list_entity_types_async
async def list_entity_types_async(*,
exclude_unauthorized: bool = False
) -> list[EntityType]
Asynchronously list entity-type stored objects.
Arguments:
exclude_unauthorized- Whether unauthorized entity types should be omitted.
Returns:
Generated entity-type payloads.
get_entity_type
def get_entity_type(*,
name: str | None = None,
entity_type_id: str | None = None,
exclude_unauthorized: bool = False) -> EntityType | None
Fetch one entity type by name or stored-object id.
Arguments:
name- Optional entity type name.entity_type_id- Optional stored-object identifier.exclude_unauthorized- Whether unauthorized entity types should be omitted.
Returns:
The entity-type payload, or None when it does not exist.
Raises:
ValidationError- When neither or both ofname/entity_type_idare provided.DocumentOperationError- When the Data Hub call fails.
get_entity_type_async
async def get_entity_type_async(
*,
name: str | None = None,
entity_type_id: str | None = None,
exclude_unauthorized: bool = False) -> EntityType | None
Asynchronously fetch one entity type by name or stored-object id.
Arguments:
name- Optional entity type name.entity_type_id- Optional stored-object identifier.exclude_unauthorized- Whether unauthorized entity types should be omitted.
Returns:
The entity-type payload, or None when it does not exist.
Raises:
ValidationError- When neither or both ofname/entity_type_idare provided.DocumentOperationError- When the Data Hub call fails.
hydrate
def hydrate(model_cls: type[EntityModelT],
payload: Mapping[str, Any] | BaseVIEntity) -> EntityModelT
Validate a payload with a handwritten entity model.
Arguments:
model_cls- Handwritten or generated entity model class.payload- Raw VI payload or existing entity model.
Returns:
The validated entity model instance.
filter_entity_types
def filter_entity_types(
entity_types: Sequence[EntityType],
*,
include: Sequence[str] = (),
exclude: Sequence[str] = ()
) -> list[EntityType]
Filter entity types by include/exclude name lists.
Arguments:
entity_types- Generated entity-type payloads to filter.include- Optional entity type names that must be kept.exclude- Optional entity type names that must be removed.
Returns:
Filtered entity-type payloads in input order.
Raises:
ValidationError- When an entity type carries no name.NotFoundError- When a name inincludeis not amongentity_types.