worldbank / REaLTabFormer

A suite of auto-regressive and Seq2Seq (sequence-to-sequence) transformer models for tabular and relational synthetic data generation.
https://worldbank.github.io/REaLTabFormer/
MIT License
203 stars 23 forks source link

How to model N-M association tables? #21

Open echatzikyriakidis opened 1 year ago

echatzikyriakidis commented 1 year ago

Hi @avsolatorio !

I was wondering how someone could model N-M table relationships.

Currently, we can model 1-1 and 1-N relationships with parent (tabular) and child (relational) models. However, is it possible to model N-M association tables?

An example association table could be student_courses_registrations that unites students and courses. A student can attend many courses and a course could be taken by multiple students:

courses ---- 1-N ---> students_courses_registrations <----- M-1 ----- students

Should we create parent tabular models for courses and students tables and then somehow use a child relational model for students_courses_registrations? Is it possible?

I can't find a way to do it. I was wondering if there is way to convert a N-M table to multiple 1-N relationships and then model the relationships separately. Of course later on I will have to revert the process to convert them to a N-M single table when sampling data.

What do you think? Is there a way to do it?