Skip to main content
This parameter ensures that joins that fan out the result set (i.e., many orders for a single user) do not impact counts or sums. Properly defining the relationship type is crucial for accurate metric calculations.

Syntax

relationship_type: <relationship>

Properties

relationship_type
string
required
The cardinality of the relationship between the joined tables. Can be:
  • one_to_one - Each row in the source view matches exactly one row in the joined view
  • many_to_one - Multiple rows in the source view can match one row in the joined view
  • one_to_many - One row in the source view can match multiple rows in the joined view
  • many_to_many - Multiple rows in the source view can match multiple rows in the joined view
  • assumed_many_to_one - Omni-generated. This is a default join generated by Omni based on naming convention. For example, an orders table with a user_id and a users table with an id or user_id. These joins are intended to accelerate the initial exploration of a data source and can therefore be modified or deleted. To accept the joins as canonical to the model, remove the assumed_ prefix from the relationship type.

Examples

One-to-one relationship between buyers and buyer_facts
- join_from_view: buyers
  join_to_view: user_facts
  join_to_view_as: buyer_facts
  join_type: always_left
  on_sql: ${buyers.id} = ${buyer_facts.id}
  relationship_type: one_to_one
Omni-generated assumed_many_to_one
- join_from_view: order_items
  join_to_view: orders
  join_type: always_left
  on_sql: ${order_items.order_id} = ${orders.id}
  relationship_type: assumed_many_to_one