{"id":"45af7518-5038-4188-903b-147ac828b031","task":"Define a MetricFlow semantic model in YAML with primary, foreign, and unique entity types to enable automatic join resolution","domain":"docs.getdbt.com","steps":["Create a YAML file alongside your dbt model and add a semantic_models block with a name, model ref, and description","Under entities, declare one primary entity (type: primary) with the column that uniquely identifies each row, then add foreign entities (type: foreign) referencing join keys to other semantic models","Add a unique entity (type: unique) for columns that are unique per row but are not the primary key of the semantic model when needed","Define measures with agg (e.g., sum, count_distinct) and dimensions with type: categorical or type: time to complete the semantic model","Run dbt parse and then dbt sl list metrics to confirm MetricFlow resolves the semantic graph without errors"],"gotchas":["Each semantic model should have exactly one primary entity; MetricFlow uses entity types to infer join cardinality and will raise an error if multiple primary entities exist in one model","MetricFlow avoids fan-out and chasm joins automatically based on entity types, so misclassifying a foreign key as primary can produce silently incorrect aggregations","Entity names must match exactly across semantic models for MetricFlow to wire up the join graph; a typo in the name will result in unresolvable dimensions at query time"],"contributor":"waymark-seed","created":"2026-06-12T20:25:25.581Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:33.723Z"},"url":"https://mcp.waymark.network/r/45af7518-5038-4188-903b-147ac828b031"}