Importing your data

Introduction

In this optional lesson, you will

  1. Explore how the Northwind graph data model was created using the Import tool

  2. Import your own data.

Northwind Graph Data Model

Your task is to:

  1. Create a new graph data model

  2. Download and load the Northwind dataset

  3. Create nodes and relationships by mapping the source data to the graph data model

Continue with the lesson to build the graph data model

Import the Northwind dataset

You need to download the Northwind dataset and create a new blank graph data model:

  1. Download the empty Northwind dataset

  2. Open the Import tool in Aura and select Graph Models.

    Open Import Tool →
    Aura Console - Import - Graph Models
  3. Create a new graph data model.

    Blank graph model in the Import tool
  4. Use the …​ menu to Open model (with data) and select the northwind-customer.zip file you downloaded.

    …​ menu - Open model with data
  5. 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.

    The northwind dataset, files and graph data model

Nodes

The Customer node has already been created for you.

Customer node in the graph data model

You are going to create the Order nodes:

  1. Create a new Node label - Order

    + Node Label button highlighted
  2. Add the Order as the Label

  3. Select orders.csv as the Table

  4. Use the Map from table function to create the properties:

    Map from table button highlighted
  5. Select all the columns, except the customerId and employeeId.

    All columns selected except customerId and employeeId

    When you confirm the mapping, the properties, their data types, and column will be automatically mapped.

    Properties mapped from the table columns
  6. The orderId property should be selected as the unique ID.

  7. Run the import to create the Customer and Order nodes.

View the orders in the graph:

cypher
Order nodes
MATCH (o:Order)
RETURN o
LIMIT 100
Result of the query showing the Order nodes

Relationships

You can now create the (Customer)-[:PURCHASED]→(Order) relationship.

  1. Drag a relationship from the Customer node to the Order node.

    Creating a relationship by dragging an arrow from the source node to the target node
  2. Set the Relationship Type to PURCHASED

  3. Select orders.csv as the Table

  4. The Node ID mapping tells Import how to connect the nodes.

    • Select customerID from the the Customer node

    • Select orderID from the Order node

      The setup of the purchased relationship, showing the node ID mapping
  5. Run the import

Need a working solution?

To update the graph data model with the solution, you can:

  1. Open Query and delete all the data from your instance:

    cypher
    MATCH (n) DETACH DELETE n
  2. Download the Customer-PURCHASED-Order data model - northwind-customer-order.zip.

  3. Use the …​ menu, select Open Model (with data), and select the northwind-customer-order.zip file you downloaded.

    …​ menu and  Open Model (with data) highlighted
  4. Run the import.

When you have added the Order nodes and PURCHASED relationships you can view the customer’s orders:

cypher
Customer orders
MATCH (c:Customer)-[p:PURCHASED]->(o:Order)
RETURN c,p,o
LIMIT 100
Result of the query showing customers, their purchased relationships and the orders

This process of adding nodes and relationships to the graph data model, and mapping them to source data, can be repeated to continue to extend the graph with more data.

Challenge

Your task is to add the Product nodes and ORDERS relationship to Order nodes.

mermaid
Order ORDERS Product
graph TD
    Order -->|ORDERS<br/>unitPrice<br/>quantity<br/>discount| Product
        
    Product(("<b>Product</b>"))    

    Order(("<b>Order</b>"))

To include the product nodes you will need to:

  1. Add a new Product node label importing from products.csv

  2. Map the properties from the table

  3. Set the productId as the unique ID.

To create the relationship from Order to Product:

  1. Drag a new relationship from Order to Product with type ORDERS

  2. Use order-details.csv as the source table.

  3. Use the orderID and productID for the node ID mapping.

  4. Map the unitPrice, quantity and discount as relationship properties.

Need a working solution?

To update the graph data model with the solution, you can:

  1. Open Query and delete all the data from your instance:

    cypher
    MATCH (n) DETACH DELETE n
  2. Download the Customer-Order-Product data model - northwind-customer-order-product.zip.

  3. Use the …​ menu, select Open Model (with data), and select the northwind-customer-order-product.zip file you downloaded.

    …​ menu and  Open Model (with data) highlighted
  4. Run the import.

When you have added the customer’s purchased products, you can view the customers complete product orders:

cypher
Customer orders
MATCH (c:Customer)-[p:PURCHASED]->(o:Order)-[or:ORDERS]->(pr:Product)
RETURN c,p,o,or,pr
LIMIT 100
Result of the query showing customers, their purchased relationships, the orders and products

Import your own data

Using the Import tool you can add your own data and create a graph data model.

You can import data directly from different sources, including:

  • PostgreSQL

  • MySQL

  • SQL Server

  • Oracle

  • Big Query

  • Databricks

  • Snowflake

  • AWS S3

  • Azure Blobs & Data Lake Storage

  • Google Cloud Storage

Lesson Summary

In this lesson, you learned how to use the Import tool to create a graph data model and map source data.

In the next module, you will learn how to work with your graph database using the Aura Explore, Dashboard, and Agent tools.

Chatbot

How can I help you today?

Data Model

Your data model will appear here.