Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
paolo_cordini
Partner - Contributor III
Partner - Contributor III

Model a 1:N relation

Hi, 

I have a database designed in this way. The main "fact tables" has ID's fields pointing to "bridge" tables, in turn pointings to "subdetail" tables.

paolo_cordini_0-1644250138995.png

The relationship between the "main" table and the "subdetail" tables is 1:N

I am trying to figure out whether there Is a way to model such a relationship with Compose.

I cannot link the main table to "bridge" tables because the relation fields are not primary keys. I cannot define them as primary keys because they are not unique.

So I cannot use this relationship in Data Mart definition.

Thanks

Paolo

Labels (3)
1 Solution

Accepted Solutions
paolo_cordini
Partner - Contributor III
Partner - Contributor III
Author

Hi

actually, I could say there are many fact tables. The table I called "Main Table" is a fact table but "Detail1", "Detail2", are fact tables too, with 1:n relationship with the main one.

I cannot pivot the data set because I don't know in advance how many rows are in "Detail" tables for one record in the Main Table.

The solution I adopted for the moment is to leave the tables unrelated in the data model. In the Data Mart I defined as "dimensions" (even if they aren't) the detail tables, so I could flatten "Bridge" and "Detail" but without linking them to the fact table.

It's ugly and non-canonical, but it works for the final users because the Main Table and Detail tables must remain separated.

Thank you

Paolo

View solution in original post

4 Replies
Nanda_Ravindra
Support
Support

Hello @paolo_cordini ,

 

           I am not seeing any direct way to model such a relationship with Compose. If you are still looking for a solution, please open a support case, and the team should be able to assist you if there are any workarounds.

 

Thanks,

Nanda

    

TimGarrod
Employee
Employee

Hi,  Can you provide some info on what you would want the "fact" table to look like?  

This feels like a scenario where pivoting the data set to flatten the multiple values in the DW model may support what you are looking for - but would be good to understand output to be able to provide possible solutions. 

paolo_cordini
Partner - Contributor III
Partner - Contributor III
Author

Hi

actually, I could say there are many fact tables. The table I called "Main Table" is a fact table but "Detail1", "Detail2", are fact tables too, with 1:n relationship with the main one.

I cannot pivot the data set because I don't know in advance how many rows are in "Detail" tables for one record in the Main Table.

The solution I adopted for the moment is to leave the tables unrelated in the data model. In the Data Mart I defined as "dimensions" (even if they aren't) the detail tables, so I could flatten "Bridge" and "Detail" but without linking them to the fact table.

It's ugly and non-canonical, but it works for the final users because the Main Table and Detail tables must remain separated.

Thank you

Paolo

lyka
Support
Support

Hi Paolo, 

 

It looks like you have found a solution based on your last comment. We suggest submitting a feature request thru our Ideation  for your intended use case.

 

Thanks

Lyka