Skip to content

Commit 6ce4b1b

Browse files
authored
Merge pull request #7567 from segmentio/DOC-1090
info note on junction table joins [DOC-1090]
2 parents 31f56ce + f7772be commit 6ce4b1b

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/unify/data-graph/index.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,25 @@ For many:many relationships, define the join on between the two entity tables wi
351351

352352
**Junction table spec**
353353

354-
| Parameters | Definition |
355-
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
354+
| Parameters |Definition |
355+
| --------------- | --------------------------------- |
356356
| `table_ref` | Defines the fully qualified table reference to the join table: `[database name].[schema name].[table name]`. Segment flexibly supports tables, views and materialized views |
357357
| `primary_key` | The unique identifier for the given table. Must be a column with unique values per row |
358358
| `left_join_on` | Define the relationship between the left entity table and the junction table: `[left entity slug].[column name] = [junction table column name]`. Note that schema and table are implied within the junction table column name, so you do not need to define it again |
359359
| `right_join_on` | Define the relationship between the junction table and the right entity table: `[junction table column name] = [right entity slug].[column name]`. Note that schema and table are implied within the junction table column name, so you do not need to define it again |
360360

361+
362+
When you define a many-to-many relationship using a junction table, `left_join_on` and `right_join_on` tell Data Graph how to connect each entity to the junction table:
363+
364+
* Use `left_join_on` to specify which column in the junction table links to the parent (left) entity.
365+
366+
* Use `right_join_on` to specify which column links to the child (right) entity.
367+
368+
These fields define the join conditions, but they don’t control how the join is executed. Data Graph always performs inner joins, even if you specify a `left_join_on`.
369+
370+
If you need behavior similar to a left join (like including unmatched rows), create a view in your warehouse with the logic you’re targeting and reference that view as an entity in your graph.
371+
372+
361373
**Example:**
362374

363375
```python

0 commit comments

Comments
 (0)