LOAD CSV Data Import
Master Neo4j's LOAD CSV clause in a hands-on lab. Read CSV files row by row, convert types, connect nodes, and build imports you can safely re-run.
In this 40-minute lab, you will learn
LOAD CSV is the Full definition for Cypher (opens in a new tab)Neo4j's implementation of GQL, the ISO standard query language for graph databases. It is declarative: you describe the pattern to find, and the database decides how to find it. clause that turns flat files into graphs. It reads a CSV file row by row and hands each row to the rest of your query, where MERGE and CREATE do the work of building Full definition for node (opens in a new tab)A vertex in a graph. In a property graph it can carry labels and properties. and Full definition for relationship (opens in a new tab)A named, directed connection between two nodes. Every relationship has a type, a start node and an end node.. Because it runs anywhere Cypher runs, it is the most portable way to import CSV data into Neo4j: no extra tools, no separate pipeline, just a query.
In this hands-on lab, you will use LOAD CSV to populate an empty Neo4j database with a graph of movies, people, and the roles that connect them. You will work through the clause from first principles to a complete, re-runnable import. Every technique is one you will reuse the next time someone hands you a folder of CSV exports and asks for a graph.
LOAD CSV fundamentals
Read CSV files, inspect headers, and understand how Neo4j processes rows.
Data type conversions
Convert CSV string values to integers, floats, and lists using built-in Cypher functions.
Creating relationships from CSV
Use MATCH and MERGE patterns to connect nodes from separate CSV sources.
Idempotent import pipelines
Design imports that can be safely re-run without creating duplicates.
Error handling and missing data
Filter out incomplete rows, handle null values with coalesce, and batch large imports for resilience.
Who this course is for
This lab is for anyone who wants to learn the
LOAD CSVclause itself, in depth and by doing: developers who prefer working in code over a visual tool, analysts who receive data as CSV exports and need it queryable as a graph, and learners who have finished the Full definition for Cypher (opens in a new tab)Neo4j's implementation of GQL, the ISO standard query language for graph databases. It is declarative: you describe the pattern to find, and the database decides how to find it. basics and want a concrete project. You should be comfortable with the basic Cypher taught in Neo4j Fundamentals and Cypher Fundamentals, since the import Full definition for pattern (opens in a new tab)A graph structure written in Cypher, such as a node joined to another node by a relationship. here combineLOAD CSVwithMATCH,MERGE, andWHERE. The lab is short and entirely hands-on: you spend the 40 minutes writing and running import statements against your own database.What you'll do
You will start with an empty database and finish with a connected movie graph, built entirely with Full definition for Cypher (opens in a new tab)Neo4j's implementation of GQL, the ISO standard query language for graph databases. It is declarative: you describe the pattern to find, and the database decides how to find it. you wrote yourself. First you will learn how
LOAD CSVactually works: how it fetches a file from a URL, howWITH HEADERSturns each row into a map keyed by column name, and how Neo4j processes the file one row at a time. You will then importPersonandMovieFull definition for node (opens in a new tab)A vertex in a graph. In a property graph it can carry labels and properties. with correctly typed Full definition for property (opens in a new tab)A named value stored on a node or a relationship. using conversion functions such astoInteger()andtoFloat(), and useMATCHto find nodes by identifier and create the Full definition for relationship (opens in a new tab)A named, directed connection between two nodes. Every relationship has a type, a start node and an end node. between them.The second half of the lab is about robustness. You will make your import idempotent, replacing
CREATEwithMERGEso re-running a statement cannot produce duplicates, filter out rows with missing values withWHERE, supply defaults withcoalesce(), and batch large imports. The lab closes with a final challenge: importing a complete dataset in a single, end-to-end pipeline.Where to go next
The Full definition for pattern (opens in a new tab)A graph structure written in Cypher, such as a node joined to another node by a relationship. in this lab scale directly to your own data: swap the movie files for your CSV exports and the same statements apply. Importing CSV data into Neo4j goes further with Cypher-based importing, covering list Full definition for property (opens in a new tab)A named value stored on a node or a relationship., adding Full definition for label (opens in a new tab)A tag on a node that groups it with other nodes of the same kind. A node can carry more than one. from data, and managing Full definition for transaction (opens in a new tab)A unit of work that either succeeds in full or leaves no trace. with
CALL { ... } IN TRANSACTIONS, while Importing Data Fundamentals introduces the Neo4j Full definition for Data Importer (opens in a new tab)The Neo4j tool for loading CSV files into a graph by mapping their columns onto nodes and relationships., the visual alternative.LOAD CSValso appears on the Neo4j Certified Professional exam, so the practice you get here counts directly toward earning that certification.
Posts from the GraphAcademy blog.
My five favorite cards in Aura Dashboards
When Dashboards first became available in Aura, I started to move my reporting away from custom tools. Here are the five cards I use the most, and a Cypher statement behind them.
SQL to Cypher - 10 Queries You Already Know
You already know how to write these queries. This article shows you what they look like when the joins go away.
Writing Cypher Queries That Don't Lose Your Data
The query trap that hides your newest data, and the query shape that brings it back.