Introduction
You are going to import a relational dataset into your Neo4j Aura instance using the Import tool.
You will need to:
-
Download the Northwind dataset
-
Create a new graph data model
-
Open the Northwind dataset in the Import tool
-
Map the tables to the graph data model
-
Run the import
Northwind Dataset
The Northwind dataset contains data about a fictional company called Northwind Traders, which imports and exports specialty foods from around the world.
The dataset contains tables for Customers, Orders, Products, Categories, and Employees.
erDiagram
CATEGORIES {
int categoryID PK
string categoryName
string etc
}
CUSTOMERS {
string customerID PK
string companyName
string etc
}
EMPLOYEES {
int employeeID PK
string firstName
string lastName
int reportsTo FK
string etc
}
PRODUCTS {
int productID PK
string productName
int supplierID FK
int categoryID FK
decimal unitPrice
string etc
}
ORDERS {
int orderID PK
string customerID FK
int employeeID FK
datetime orderDate
string etc
}
ORDER_DETAILS {
int orderID FK
int productID FK
decimal unitPrice
int quantity
}
SUPPLIERS {
int supplierID PK
string companyName
string etc
}
SHIPPERS {
int shipperID PK
string companyName
string etc
}
REGIONS {
int regionID PK
string regionDescription
}
TERRITORIES {
string territoryID PK
string territoryDescription
int regionID FK
}
EMPLOYEE_TERRITORIES {
int employeeID FK
string territoryID FK
}
%% Relationships
CATEGORIES ||--o{ PRODUCTS : "categorizes"
SUPPLIERS ||--o{ PRODUCTS : "supplies"
CUSTOMERS ||--o{ ORDERS : "places"
EMPLOYEES ||--o{ ORDERS : "handles"
EMPLOYEES ||--o{ EMPLOYEES : "reports to"
SHIPPERS ||--o{ ORDERS : "ships"
ORDERS ||--o{ ORDER_DETAILS : "contains"
PRODUCTS ||--o{ ORDER_DETAILS : "included in"
REGIONS ||--o{ TERRITORIES : "contains"
EMPLOYEES ||--o{ EMPLOYEE_TERRITORIES : "assigned to"
TERRITORIES ||--o{ EMPLOYEE_TERRITORIES : "covers"erDiagram
CATEGORIES {
int categoryID PK
string categoryName
string description
blob picture
}
CUSTOMERS {
string customerID PK
string companyName
string contactName
string contactTitle
string address
string city
string region
string postalCode
string country
string phone
string fax
}
EMPLOYEES {
int employeeID PK
string lastName
string firstName
string title
string titleOfCourtesy
datetime birthDate
datetime hireDate
string address
string city
string region
string postalCode
string country
string homePhone
string extension
blob photo
text notes
int reportsTo FK
string photoPath
}
PRODUCTS {
int productID PK
string productName
int supplierID FK
int categoryID FK
string quantityPerUnit
decimal unitPrice
int unitsInStock
int unitsOnOrder
int reorderLevel
bit discontinued
}
ORDERS {
int orderID PK
string customerID FK
int employeeID FK
datetime orderDate
datetime requiredDate
datetime shippedDate
int shipVia FK
decimal freight
string shipName
string shipAddress
string shipCity
string shipRegion
string shipPostalCode
string shipCountry
}
ORDER_DETAILS {
int orderID FK
int productID FK
decimal unitPrice
int quantity
decimal discount
}
SUPPLIERS {
int supplierID PK
string companyName
string contactName
string contactTitle
string address
string city
string region
string postalCode
string country
string phone
string fax
string homePage
}
SHIPPERS {
int shipperID PK
string companyName
string phone
}
REGIONS {
int regionID PK
string regionDescription
}
TERRITORIES {
string territoryID PK
string territoryDescription
int regionID FK
}
EMPLOYEE_TERRITORIES {
int employeeID FK
string territoryID FK
}
%% Relationships
CATEGORIES ||--o{ PRODUCTS : "categorizes"
SUPPLIERS ||--o{ PRODUCTS : "supplies"
CUSTOMERS ||--o{ ORDERS : "places"
EMPLOYEES ||--o{ ORDERS : "handles"
EMPLOYEES ||--o{ EMPLOYEES : "reports to"
SHIPPERS ||--o{ ORDERS : "ships"
ORDERS ||--o{ ORDER_DETAILS : "contains"
PRODUCTS ||--o{ ORDER_DETAILS : "included in"
REGIONS ||--o{ TERRITORIES : "contains"
EMPLOYEES ||--o{ EMPLOYEE_TERRITORIES : "assigned to"
TERRITORIES ||--o{ EMPLOYEE_TERRITORIES : "covers"Create a graph data model
Continue with the lesson to create the graph data model
Import the Northwind dataset
You need to download the Northwind dataset and create a new blank graph data model:
-
Open the Import tool in Aura and select Graph Models.
-
Create a new graph data model.
-
Use the
…menu toOpen model (with data)and select thenorthwind-customer.zipfile you downloaded.
-
You will see the tables (csv files) from the Northwind dataset in the left-hand panel, and a single Customer node in the graph data model.
Review the Data Source
Review the data source tables and try to identify:
-
What tables will become Node labels
-
The associated relationships between tables through their primary/foreign keys
-
What fields will become properties on nodes and relationships
Customer node
The Customer node has already been created for you.
Select the node in the graph data model and review the data model in the right hand panel.
You should be able to identify the following:
-
The node label -
Customer. -
The source table -
customers.csv. -
The node properties - the
name, what datatypeis used, and whatcolumnfrom the source table is used for each property. -
What property is used as the unique ID for the node label -
customerId.
Run the import
Run the import to create the Customer nodes:
-
Click Run Import
-
Select your instance
-
Enter your instance credentials
-
A summary of the import will be displayed
Query the graph
You can view the Customers in the graph using the Query tool:
MATCH (c:Customer)
RETURN c
Next
Lesson Summary
In this lesson, you imported customer data from the Northwind dataset and started to build a graph data model.
In the next lesson, you will continue to build the graph data model by adding Order nodes and PURCHASED relationships between customers and orders.