In the previous lesson, you learned how to create nodes using the Data Importer. In this lesson, you will learn how to create relationships between nodes.
Creating Relationships in Data Importer
Relationships connect nodes and represent how data is connected. In the Northwind model, relationships include:
-
Customer -[:PLACED]→ Order
-
Order -[:CONTAINS]→ Product
-
Product -[:IN_CATEGORY]→ Category
-
Supplier -[:SUPPLIES]→ Product
Step 1: Create Nodes First
Ensure all node types exist first:
-
Add all node labels: Customer, Order, Product, Category, Supplier, and others
-
Map properties from CSV files
-
Set unique identifiers for each node type
Step 2: Draw a Relationship
In the Data Importer canvas:
-
Hover over the edge of the source node until you see the + icon
-
Drag from the source node to the target node
-
Release to create the relationship
In the Definition panel:
-
Enter the relationship type such as PLACED, CONTAINS, or IN_CATEGORY
-
Select the data source — the CSV file — that contains the relationship data
-
Map the From ID - the column that matches the source node’s unique identifier
-
Map the To ID - the column that matches the target node’s unique identifier
-
Optionally map relationship properties from additional columns
Green checkmarks indicate valid mappings
The Data Importer shows a green checkmark when an element has been mapped correctly. If you see a warning, check that:
-
The ID columns match the unique identifiers on the nodes
-
The data types are compatible
-
The CSV file contains the expected columns
Step 4: Add Relationship Properties
Some relationships carry additional data. For example, the CONTAINS relationship between Order and Product includes:
-
quantity - how many units were ordered
-
unitPrice - the price at the time of order
-
discount - any discount applied
To add relationship properties:
-
Select the relationship in the model
-
Click Map from table
-
Select the columns to include as properties
-
Set appropriate data types
Example: Northwind Relationships
For the Northwind dataset, create these relationships:
| From |
Relationship |
To |
Properties |
Customer |
PLACED |
Order |
(none) |
Order |
CONTAINS |
Product |
quantity, unitPrice, discount |
Product |
IN_CATEGORY |
Category |
(none) |
Supplier |
SUPPLIES |
Product |
(none) |
Employee |
PROCESSED |
Order |
(none) |
Order |
SHIPPED_BY |
Shipper |
(none) |
Employee |
REPORTS_TO |
Employee |
(none) |
Importing Nodes and Relationships from a Single File
Northwind uses separate CSV files per table, but you often encounter denormalized or joined data where one file contains both node and relationship data.
Example: A ratings.csv file with movieId, userId, name, rating, timestamp can create both User nodes and RATED relationships to Movie nodes.
The process is the same as with multiple files:
-
Upload the single CSV file to Data Importer
-
Create the node label and relationship in the model
-
Map the same file as the data source for both the node and the relationship
-
Map node columns (e.g. userId, name) to the User node, and relationship columns (e.g. rating, timestamp) to the RATED relationship
-
Set the Node ID mappings: From userId (User) and To movieId (Movie)
-
Run the import
When the source combines entity and linkage data, Data Importer creates the nodes and relationships in one pass. Ensure the file has columns for both the node identifier and the relationship target identifier.
Verify Relationships
Verify relationships:
Using the Data Importer
With AuraDB, the Data Importer is integrated:
-
Open your instance and click Import
-
Design your model with nodes and relationships
-
Click Run import to execute
Check Your Understanding
Relationship ID Mapping
When creating a relationship in the Data Importer, what must you map to connect two nodes?
Hint
Relationships connect nodes using their unique identifiers. The Data Importer needs to know which column in the CSV matches the ID on each node.
Solution
You must map the unique identifiers (IDs) of the source and target nodes. The Data Importer uses these IDs to find the correct nodes and create the relationship between them.
For example, to create a PLACED relationship between Customer and Order, you map:
Summary
In this lesson, you learned how to create relationships in the Data Importer by:
-
Drawing connections between nodes
-
Mapping ID columns to link nodes
-
Adding relationship properties
In the next lesson, you will learn how to handle complex data scenarios during import.