marivo.semantic.entity#
- marivo.semantic.entity(*, name, datasource, source, primary_key=None, versioning=None, domain=None, ai_context=None)[source]#
Declare an entity over a structured physical source.
- Parameters:
name (str) – Entity name.
datasource (DatasourceRef | str) – Datasource ref returned by
md.ref(...)or a global datasource name string declared inmodels/datasources/*.py.source (TableSourceIR | ParquetSourceIR | CsvSourceIR) – Structured physical source, usually
ms.table(...)orms.parquet(...), orms.csv(...).primary_key (list[str] | None) – Optional list of column names forming the primary key.
domain (DomainRef | None) – Override the active domain namespace with a
DomainRefreturned byms.domain(...). Defaults to the file’s default domain.ai_context (AiContext | None) – Optional
AiContextwith extra agent-facing hints.versioning (SnapshotVersioningIR | ValidityVersioningIR | None)
- Returns:
An
EntityRefusable by@ms.dimensionand@ms.metric.- Raises:
SemanticDecoratorError –
datasourceis not a datasource ref or string,namecollides with another object, orsourceis not an entity source.- Return type:
Example
>>> orders = ms.entity( ... name="orders", ... datasource="warehouse", ... source=ms.table("orders", database="sales_mart"), ... )