> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omni.co/llms.txt
> Use this file to discover all available pages before exploring further.

# relationship_type

> Defines the cardinality relationship between joined tables.

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

```yaml theme={null}
relationship_type: <relationship>
```

## Properties

<ParamField path="relationship_type" 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.
</ParamField>

## Examples

```yaml title="One-to-one relationship between buyers and buyer_facts" highlight={6} theme={null}
- 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
```

```yaml title="Omni-generated assumed_many_to_one" theme={null}
- 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
```
