Solved

How do you create many to many relationships in your data models?

  • 4 October 2021
  • 2 replies
  • 182 views

  • Known Participant
  • 11 replies

I have read the documentation and university courses on data modelling and the text often mentions many-to-many relationships such as product tags. This is displayed in the data model as having a bi-directional arrow and will allow filtering of products by tag on data dashboards.

 

 

However, when I import database tables from my database, the model only ever shows the arrows going from products to tags only, which means I can never use the tags table to filter my products.

 

My pivot table has the following columns:

id (the id of the pivot item)

product_id (foreign key that links to id on the products table)

tag_id (foreign key that links to id on the tags table)

 

Each product can have multiple tags and each tag can have multiple products, but this is not reflected in the data model diagram. What am I doing wrong?

 

icon

Best answer by Julius Kos 4 October 2021, 13:18

View original

2 replies

Perfect! Thank you so much Julius, that has solved the issue for me. I used the small blue circle to create a connection from the tag pivot table back to the product table and it now appears as a bi-directional link.

Thanks again

Userlevel 2

Hi PD5,

 

There is nothing wrong in this case. However, the connections themselves must be created by you through the LDM modeller. Please use the small blue circle on the edge of the dataset and drag and drop to distinguish the suitable direction: 

 

 

Reply