Import

This section describes how to perform batch imports of data into Neo4j.

You can do batch imports of large amounts of data into a Neo4j database from CSV files, using the import command of neo4j-admin. This tool can only be used to load data into a previously unused database. By default, this database is set to neo4j but can be configured to other names and locations. If you wish to import small to medium-sized CSV files into an existing database, use LOAD CSV (see Cypher Manual → LOAD CSV).

These are some things you will need to keep in mind when creating your input files:

  • Fields are comma-separated by default but a different delimiter can be specified.

  • All files must use the same delimiter.

  • Multiple data sources can be used for both nodes and relationships.

  • A data source can optionally be provided using multiple files.

  • A separate file with a header that provides information on the data fields, must be the first specified file of each data source.

  • Fields without corresponding information in the header will not be read.

  • UTF-8 encoding is used.

  • By default, the importer will trim extra whitespace at the beginning and end of strings. Quote your data to preserve leading and trailing whitespaces.

Indexes and constraints

Indexes and constraints are not created during the import. Instead, you will need to add these afterwards (see Cypher Manual → Indexes).

This chapter explains how to format the input data and use the import tool. If you wish to see in-depth examples of using the import tool, refer to the Import tutorial.

The following sections describe how to use the import tool:

  • Syntax - The syntax of the neo4j-admin import command.

  • CSV header format - How to construct the header row of each CSV file.

  • Options - The options available for use with neo4j-admin import.