Problems with Importing Relationships from CSV using backendless example

Hi everyone. I just tried to duplicate the One to One relationship in your example on the following page…

https://backendless.com/docs/rest/mgmt_import.html

I created, copied and pasted both the Orders.csv and Product.csv tables and then tried to import them with the following Foreign Key in Order.csv

customer__Customer__bcklsFK_ONE_TO_ONE

(Please keep in mind I had to remove an extra underscore between bcklsFK and ONE… in order for backendless to recognize it… Here’s the original FK name on your page which didn’t work: columnName__Filename__bcklsFK__ONE_TO_ONE )

Anyways once I removed that extra underscore and imported both tables, the import type mappings did not show any customer relations like you have displayed in your example here.

Instead this is what my screen looks like…

Any help on this would be great thanks!

As a suggestion it would be great to update this import relationship help page to also include a Many to Many example.

Hello @William_Lee

Try with export_3.zip (659 Bytes)

I created an internal ticket (BNDLSS-24082). We will inform you about his progress in this topic additionally.

1 Like

Thanks for your help Vladimir. I was able to get your demo data working. Please update me on the ticket as well.

I have two questions regarding this Relationship Column:

“relation({”“constraints”":[],"“type”":"“RELATION”","“autoLoad”":false,"“relatedTable”":"“Child”"})"

  1. Is it necessary to declare either a “ONE_TO_ONE” or “ONE_TO_MANY” in this string?

  2. If it’s needed, how do I declare a “ONE_TO_MANY” relationship?

Thanks!

Hello @William_Lee

“relation({”“constraints”":[],"“type”":"“RELATION”","“autoLoad”":false,"“relatedTable”":"“Child”"})"
relation - name of relation column
type - type of relation (RELATION=1:1, RELATION_LIST=1:N)
But if it is one-to-many relay, then it will not be in the Parent table, but in the Child.

In order for you to have the correct file structure, use my advice from your other topic - Best way to import Many to Many relations between 2 tables "Companies" & "Categories" - #5 by Vladimir_Yalovy

What is your applicationId?

1 Like

Awesome Thank You! I was able to get the following schema going with just your previous advice with the modified relationship column title.

This is just a test DB but the app id is 4E728185-16AC-D843-FF61-4A0DC6B6CA00

I’m going to try your new ONE to MANY commands as well.

Hi Vladimir,

RELATIONSHIP_LIST isn’t being recognized.
Only RELATIONSHIP seems to work. Am I doing anything wrong again here?

I created a Parent called “Stores.csv” and a Child called “Employees.csv”

Thanks

I think I figured it out.
The table I’m trying to import is the TitlesAuthor.csv and it’s a Many to Many join table and it looks like MM Tables can only use a RELATION and not a RELATION_LIST when they refer to both their parents.

I tried something else by imported a simple 2 table parent and child… and using RELATION_LIST on the child table worked.