Glossary/Semantic Layer & Metrics

Join Relationships

Join relationships are formally defined connections between tables in a semantic model that specify cardinality, join type, and join keys, enabling consistent and correct table combinations in queries.

Join relationships define how tables connect. A relationship specifies: which tables join (e.g., orders and customers), on which keys (customer_id = orders.customer_id), what cardinality exists (one customer has many orders), and what join type applies (inner, left outer, etc.). Rather than leaving join logic implicit in SQL, a semantic model makes these relationships explicit and reusable.

Join relationships solve fragility and inconsistency in analytics. Without formalized relationships, different analysts write different JOINs: some use left outer join, others inner; some join on customer_id, others on email address. This produces different results. Relationship definitions enforce consistency: the semantic layer ensures all queries joining orders to customers use the same logic. Relationships also prevent join errors like unintended many-to-many multiplications that inflate metrics.

Relationships are typically bidirectional: knowing orders-to-customers relationships enables reverse joins (find customers without orders). Some relationships are conditional: a join only applies when certain filters are present. The semantic model documents relationship strength: whether a join is 1:1, 1:many, many:1, or many:many, which determines correct aggregation. Invalid joins (crossing incompatible cardinalities) can be flagged automatically.

Key Characteristics

  • Specify join key columns between tables
  • Document cardinality (1:1, 1:many, many:many)
  • Define join type (inner, left, right, full, cross)
  • Formalized in semantic models or metadata
  • Enable reverse relationships and discovery
  • Prevent unintended many-to-many joins

Why It Matters

  • Correctness: Enforced relationships prevent join errors and metric inflation
  • Consistency: All queries use the same join logic
  • Performance: Query engines optimize based on cardinality knowledge
  • Discoverability: Teams understand table relationships without SQL knowledge
  • Governance: Track relationship changes and dependencies

Example

A relationship defines: orders.customer_id (many) to customers.id (one), left join type. The semantic layer enforces this join whenever both tables are referenced. If a query needs to find customers without orders, the reverse relationship (customers to orders) automatically uses left anti-join, preventing errors.

Coginiti Perspective

SMDL defines join relationships between entities with explicit cardinality (one_to_one, one_to_many, many_to_one) and join expressions using semantic identifiers. These relationship definitions allow Semantic SQL to generate correct joins implicitly when a query references dimensions or measures from related entities. Analysts do not write JOIN clauses; the query engine infers the join path from the SMDL relationship graph. Explicit joins remain available in Semantic SQL for cases where the implicit path needs to be overridden.

Related Concepts

See Semantic Intelligence in Action

Coginiti operationalizes business meaning across your entire data estate.