Overview of the Neo4j Data Importer

What is the Neo4j Data Importer?

Neo4j Data Importer is a graph app the allows you to import CSV files from your local system into the graph. With this graph app, you can examine the CSV file headers, and map them to nodes and relationships in a Neo4j graph. You connect to a running Neo4j DBMS to perform the import. The benefit of the Data Importer is that you need not know Cypher to load the data.

It is useful for loading small to medium CSV files that contain fewer that 1M rows.

Data that is imported into the graph can be interpreted as string, integer, float, datetime, or boolean data. If a field in a row needs to be stored in the graph as a list, it will be by default stored in the graph as a string and you will need to post-process the graph after the import. You will learn about this later in this course.

For this course, we use Neo4j Data Importer Version 0.7.0. This version of Neo4j Data Importer can be found here

Neo4j Data Importer Versions

Neo4j Data Importer Early Access is evolving rapidly.

Here are the URLs for launching the latest version of Neo4j Data Importer:

In this course we use the neo4j.io Version 0.7.0 of Neo4j Data Importer since we use a Neo4j Sandbox instance for this course.

While the essence of the product remains the same, the UI may look different as the versions of the product evolve.

Requirements for using the Data Importer

  • You must use CSV files for import.

  • CSV files must reside on your local system so you can load them into the graph app.

  • CSV data must be clean (you learned this in an earlier lesson).

  • IDs must be unique for all nodes you will be creating.

  • The CSV file must have headers.

  • The DBMS must be started.

Steps for using the Data Importer

Before you do the import, you should have a starting idea of how your graph data model will be implemented. The UI for the Data Importer uses the same UI elements that are used in the Arrows app.

In this lesson, we describe the steps that you will follow in the next Challenge. Do NOT perform these steps in this lesson.

Step 1: Placing the CSV file(s) on your local system and ensure they have headers and are clean.

You will examine the files and make sure they have headers and are "clean", as you learned about in an earlier lesson.

Step 2: Opening the Neo4j Data Importer

In the next Challenge, you will open the Data Importer app from any Web browser using this URL: https://data-importer.neo4j.io/versions/0.7.0/?acceptTerms=true

The Neo4j Data Importer UI is evolving. You may see minor differences in the UI if you use a different version of Neo4j Data Importer.
Neo4j Data Importer

When you open Data Importer, it asks you to connect to a running DBMS. This is where you provide the WebSocket Bolt URL and password for the sandbox instance used for this course.

Connect to Sandbox

Step 3: Loading the CSV files on your local system into the graph app

You will either drag the CSV files into the Files pane on the left or use Browse to select them as shown here.

Select CSV files

Here is what you will see after you have selected the files for import:

Selected CSV files

Step 4: Examining the CSV header names used in the CSV files

You will examine the first rows of each CSV file to determine:

  • Files to be used to create nodes.

  • Files to be used to create relationships.

  • How IDs are used to uniquely identify data.

Step 5: Adding a node

You will:

  1. Add the node in the UI by clicking the Add Node icon.

Click add node
  1. Specify a label for the node in the Mapping Details pane.

Add the node label
  1. Select the CSV file to use in the Mapping Details pane.

Select CSV file

Step 6: Defining mapping details for the node

You will:

  1. Specify properties for the node (select Add from File where we select all fields).

Add all properties from file
  1. If you want a property to use a different name or type, edit the property.

Modify property name
  1. Specify the unique ID property for the node.

Select unique ID

After you have mapped properties, they will be marked in green in the left panel:

Person properties mapped

Step 7: Creating the relationships between nodes

You will:

  1. Add the relationship in the UI by dragging the edge of a node to itself or another node.

Add relationship
  1. Specify a type for the relationship in the Mapping Details pane.

Add DIRECTED label
  1. Select the CSV file to use in the Mapping Details pane.

Add DIRECTED file

Step 8: Defining the mapping details for the relationship

You will:

  1. In the Mapping Details pane, specify the from and to unique property IDs to use.

Select ID mapping
  1. If applicable, add properties for the relationship from the file (optional).

  2. Modify the names or types of the properties (if required by you data model).

  3. Confirm CSV in the left panel is all set for import.

Confirm relationship mapping done

Step 9: Performing the import

You will:

  1. Import the data.

  2. View the import results.

Step 10: Viewing the imported data in Neo4j Browser

You will view the imported data in Neo4j Browser.

If you have de-normalized data, you will need to perform a multi-pass import. That is, you cannot create multiple nodes and relationship types from a single CSV file.

Other features of the Neo4j Data Importer

You can import or export your mappings to a JSON file or to a ZIP file if you also want to include the CSV files.

Check your understanding

1. Neo4j Data Importer

Select the key features of the Neo4j Data Importer:

  • ✓ No need to use Cypher to perform the import.

  • ✓ Create nodes with a given label from a single CSV file’s mapping.

  • ✓ Create relationships with a given type from a single CSV file’s mapping.

  • ❏ In the app, you can extract from a live RDBMS and import into a Neo4j graph.

Hint

Neo4j Data Importer relies on CSV files for import and you need not use Cypher for performing the import.

Solution

Here are the key features of the Neo4j Data Importer:

  1. No need to use Cypher to perform the import.

  2. Create nodes with a given label from a single CSV file’s mapping.

  3. Create relationships with a given type from a single CSV file’s mapping.

2. Files used by the Data Importer

What statements below describes the files used by the Data Importer?

  • ❏ The files must be in a location in a public S3 bucket.

  • ✓ The files must reside your local system.

  • ✓ The files must be in CSV format.

  • ✓ The first row of the files must contain headers.

Hint

These are three, minimal requirements for files when using the Data Importer.

Solution

Files used by the Data Importer have these requirements:

  1. The files must reside your local system.

  2. The files must be in CSV format.

  3. The first row of the files must contain headers.

Summary

In this lesson, you learned what the Neo4j Data Importer is and the steps for using it. In the next challenge, you will use the Data Importer to import CSV data.