semantics/<connection-id>/<name>.yaml) is validated against SemanticSource at load time. name, connection, table, grain, and columns are required; everything else defaults. See Semantics for the concepts behind these fields.
Top-level fields
| Field | Type | Default | Governs |
|---|---|---|---|
name | str | n/a (required) | Unique identifier across the whole project. |
connection | str | n/a (required) | Which configured connection this source reads from. |
table | str | n/a (required) | Physical relation (schema.table) queried at compile time. |
grain | list[str] | n/a (required) | Row-uniqueness columns; must already be declared in columns. Drives join fanout safety. |
description | str | null | null | Free-text explanation. |
columns | list[Column] | n/a (required) | Typed physical columns; see below. |
measures | list[Measure] | [] | Aggregations over the source; see below. |
dimensions | list[Dimension] | [] | Grouping/filtering columns; see below. |
joins | list[Join] | [] | Declared join paths to other semantic sources; see below. |
filters | list[Filter] | [] | Named reusable predicates; see below. |
finality | FinalityMeta | {watermark: null} | Per-source finality watermark; see below. |
meta | SourceMeta | {provenance: inferred} | System-managed provenance metadata; see below. |
grain entry and every dimensions[].column must reference a declared column; every column a measure’s expr touches must be declared. Violations raise a located SemanticValidationError (file + YAML path), not a silent drop.
columns[]
| Field | Type | Default | Governs |
|---|---|---|---|
name | str | n/a (required) | Column name as it appears in table. |
type | NormalizedType | n/a (required) | Dialect-neutral type: string, int, decimal, float, bool, date, timestamp, json. The compiler’s dialect adapter maps this to each connector’s native type. |
nullable | bool | true | Whether the column may be NULL. |
measures[]
| Field | Type | Default | Governs |
|---|---|---|---|
name | str | n/a (required) | Measure identifier, unique within the file. |
expr | str | n/a (required) | SQL aggregate expression; may reference only declared columns. |
additivity | Additivity | additive | additive | semi_additive | non_additive; see Additivity. |
semi_additive_over | list[str] | [] | Dimensions the measure is not additive over (semi-additive measures only). |
is_p0_compilable only if it’s additive and its expr parses to a single sum/count/min/max (not count(distinct …)); measures outside that set are valid YAML but rejected at compile time with UNSUPPORTED_MEASURE, never at load time.
dimensions[]
| Field | Type | Default | Governs |
|---|---|---|---|
name | str | n/a (required) | Dimension identifier, unique within the file. |
column | str | n/a (required) | Must reference a declared column. |
granularity | str | null | null | Time bucketing, e.g. day, month. |
label | str | null | null | Human-readable display name. |
description | str | null | null | Free-text explanation. |
aliases | list[str] | [] | Alternate lookup names. |
joins[]
| Field | Type | Default | Governs |
|---|---|---|---|
to | str | n/a (required) | Target semantic source’s name. |
on | str | n/a (required) | SQL join predicate. |
relationship | Relationship | n/a (required) | one_to_one | many_to_one | one_to_many | many_to_many. |
name | str | null | null | SQL alias for the target table; defaults to to (the join’s effective alias must be unique within the file). |
filters[]
| Field | Type | Default | Governs |
|---|---|---|---|
name | str | n/a (required) | Filter identifier. |
expr | str | n/a (required) | Reusable SQL predicate. |
finality
| Field | Type | Default | Governs |
|---|---|---|---|
watermark | str | null | null | Cutoff expression before which rows are considered final; null means the source is always final. See Finality for how this combines with a contract’s FinalityRule. |
meta
System-managed — not hand-edited; reconciliation writes these fields.
| Field | Type | Default | Governs |
|---|---|---|---|
provenance | Provenance | inferred | board_approved | human_curated | inferred. board_approved/human_curated facts are never auto-overwritten; only inferred facts can be revised, and even then only through a reviewable diff. |
source_fingerprint | str | null | null | sha256 of the introspected/declared schema; drives drift detection. |
last_validated_at | datetime | null | null | When this source was last checked against live evidence. |
frozen | bool | false | Human-owned freeze marker; reconciliation flags conflicts but never edits a frozen source. |