Hi all, I have a data modeling question. I have t...
# gd-beginners
p
Hi all, I have a data modeling question. I have two tables: 1.
person
(
id
,
name
) 2.
relation
(
id
,
from_id
,
to_id
,
relation_type
) How can I define two separate relations (
person.id ↔ relation.from_id
and
person.id ↔ <http://relation.to|relation.to>_id
)? If I drag the blue relationship dot a second time, nothing happens. Currently, the only solution that works for me is creating two aliases of the
person
table (
person_from
,
person_to
) and defining relationships as follows: 1.
person_from.id ↔ relation.from_id
2.
person_to.id ↔ <http://relation.to|relation.to>_id
Is there a better solution? Example tables:
Copy code
person
| id | name    |
|----|---------|
| 1  | Alice   |
| 2  | Bob     |
| 3  | Charlie |

relation
| id | from_id | to_id | relation_type |
|----|---------|-------|---------------|
| 1  | 1       | 2     | Friend        |
| 2  | 2       | 3     | Colleague     |
| 3  | 3       | 1     | Family        |

person_to
| id | name    |
|----|---------|
| 1  | Alice   |
| 2  | Bob     |
| 3  | Charlie |
Thanks!
m
Hi Peter, thank you for your question. I would like to clarify something, with 'tables' you mean a two different Data Sets in you LDM, and you are asking about the relation in between these two Data sets? Please could you clarify.
My apologies for the previous comment. I overlooked that you explicitly meant modeling. In that case, I recommend reviewing our documentation: • Model DataBasic Rules of Data Modeling in GoodData To establish two separate relationships between your
person
and
relation
datasets in the GoodData LDM, aliasing the
person
dataset into
person_from
and
person_to
is the recommended approach, as GoodData does not permit two distinct relationships using the same dataset and column.
p
Awesome, thank you @Mauricio Cabezas
1