Here with a ForeignKey constraint then [Sep 01]

:raising_hand_man: James2169 asked

Here with a ForeignKey constraint then Parent field in Child table should be populated with ID


:person_tipping_hand: o1lab replied

Im struggling to understand what is missing.

Seems like you have created the relation correctly.

Parent A is associated with one child and Parent B in similar way

What are you expecting ? what is missing ?

:raising_hand_man: James2169 replied

So instead of manually adding each child to the parent using the GUI I expect to be able to infer the relationship from a field of ForeignKeys which in this case is called “Parent”

:raising_hand_man: James2169 replied

When I import the Parent table form a CSV I already have the ForeignKey information but NocoDB expects to to manually rekey it all in

:raising_hand_man: James2169 replied

No option for related field to existing table

:raising_hand_man: James2169 replied

And then after importing I can not select the LinkToAnotherRecord option either for the field

:person_tipping_hand: o1lab replied

ah, you mean thsi for uploading bulk and creating relations with it

I understand that is important, but this is slightly tricky than it feels

hence the upload is in alpha

the reason being : this looked-up or related-field can come from any nested level

:raising_hand_man: James2169 replied

okay thanks at least I understand there are limitations now not just I don’t understand :slightly_smiling_face:

:raising_hand_man: James2169 replied

I expected to be able to just type in or paste into the ForeignKey field without the manual GUI selection process

:person_tipping_hand: o1lab replied

thank you for the understanding :slightly_smiling_face:

:raising_hand_man: Eric replied

i think it’s important to not that defining links from child to parent doesn’t behave in the system as a valid foreign key, since the child key can only be use by one parent (exclusive). this is not a behaviour expected from a foreign key

:raising_hand_man: Eric replied

the previously implemented pattern of setting up a foreign key value from the parent is the correct modeling paradigm.

:person_tipping_hand: o1lab replied

LinkToAnotherRecord

:person_tipping_hand: o1lab replied

Has to be created in parent table

:person_tipping_hand: o1lab replied

With had many

:person_tipping_hand: o1lab replied

Has

:raising_hand_man: Eric replied

i’ll try again to confirm

:raising_hand_man: Eric replied

ok, i build another example db and tested.

:raising_hand_man: Eric replied

confirmed that the creating the key from the parent with ‘has many’ creates an exclusive one to many relationship (e.g. the linked key value can only be related to one and only one parent record).

:raising_hand_man: Eric replied

structurally, the pattern that is missing is: from a table (parent) no option for many-to-one. this is the textbook foreign key value to a domain of valid keys.