Skip to main content
A semantic source (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

FieldTypeDefaultGoverns
namestrn/a (required)Unique identifier across the whole project.
connectionstrn/a (required)Which configured connection this source reads from.
tablestrn/a (required)Physical relation (schema.table) queried at compile time.
grainlist[str]n/a (required)Row-uniqueness columns; must already be declared in columns. Drives join fanout safety.
descriptionstr | nullnullFree-text explanation.
columnslist[Column]n/a (required)Typed physical columns; see below.
measureslist[Measure][]Aggregations over the source; see below.
dimensionslist[Dimension][]Grouping/filtering columns; see below.
joinslist[Join][]Declared join paths to other semantic sources; see below.
filterslist[Filter][]Named reusable predicates; see below.
finalityFinalityMeta{watermark: null}Per-source finality watermark; see below.
metaSourceMeta{provenance: inferred}System-managed provenance metadata; see below.
Cross-field rules enforced at write time: column, measure, dimension, and join-alias names must each be unique within the file; every 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[]

columns:
  - { name: order_id, type: string, nullable: false }
FieldTypeDefaultGoverns
namestrn/a (required)Column name as it appears in table.
typeNormalizedTypen/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.
nullablebooltrueWhether the column may be NULL.

measures[]

measures:
  - name: total_revenue
    expr: "sum(amount)"
    additivity: additive
FieldTypeDefaultGoverns
namestrn/a (required)Measure identifier, unique within the file.
exprstrn/a (required)SQL aggregate expression; may reference only declared columns.
additivityAdditivityadditiveadditive | semi_additive | non_additive; see Additivity.
semi_additive_overlist[str][]Dimensions the measure is not additive over (semi-additive measures only).
A measure is 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[]

dimensions:
  - { name: order_date, column: created_at, granularity: day, label: "Order Date" }
FieldTypeDefaultGoverns
namestrn/a (required)Dimension identifier, unique within the file.
columnstrn/a (required)Must reference a declared column.
granularitystr | nullnullTime bucketing, e.g. day, month.
labelstr | nullnullHuman-readable display name.
descriptionstr | nullnullFree-text explanation.
aliaseslist[str][]Alternate lookup names.

joins[]

joins:
  - to: customers
    on: "orders.customer_id = customers.customer_id"
    relationship: many_to_one
FieldTypeDefaultGoverns
tostrn/a (required)Target semantic source’s name.
onstrn/a (required)SQL join predicate.
relationshipRelationshipn/a (required)one_to_one | many_to_one | one_to_many | many_to_many.
namestr | nullnullSQL alias for the target table; defaults to to (the join’s effective alias must be unique within the file).

filters[]

filters:
  - { name: completed, expr: "status = 'completed'" }
FieldTypeDefaultGoverns
namestrn/a (required)Filter identifier.
exprstrn/a (required)Reusable SQL predicate.

finality

finality:
  watermark: "business_day - 1 day"   # null = always-final source
FieldTypeDefaultGoverns
watermarkstr | nullnullCutoff 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.
meta:
  provenance: inferred             # board_approved | human_curated | inferred
  source_fingerprint: "sha256:…"
  last_validated_at: "2026-06-13T00:00:00Z"
  frozen: false
FieldTypeDefaultGoverns
provenanceProvenanceinferredboard_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_fingerprintstr | nullnullsha256 of the introspected/declared schema; drives drift detection.
last_validated_atdatetime | nullnullWhen this source was last checked against live evidence.
frozenboolfalseHuman-owned freeze marker; reconciliation flags conflicts but never edits a frozen source.