diff --git a/modules/ROOT/pages/import.adoc b/modules/ROOT/pages/import.adoc index 07f685090b..d0a37538ee 100644 --- a/modules/ROOT/pages/import.adoc +++ b/modules/ROOT/pages/import.adoc @@ -58,7 +58,7 @@ See <> for more details. [TIP] ==== For information on `LOAD CSV`, see the link:{neo4j-docs-base-uri}/cypher-manual/current/clauses/load-csv[Cypher Manual -> `LOAD CSV`]. -For in-depth examples of using the command `neo4j-admin database import`, refer to the xref:tutorial/neo4j-admin-import.adoc[Tutorials -> Importing data]. +For in-depth examples of using the command `neo4j-admin database import full`, refer to the xref:tutorial/neo4j-admin-import.adoc[Tutorials -> Full data import]. ==== [[import-memory-controls]] @@ -545,7 +545,8 @@ This is achieved by using the `format` option of the import command and setting [source, shell] -- -bin/neo4j-admin database import full --format=block +bin/neo4j-admin database import full \ +--format=block -- The `block` format is available in Enterprise Edition only. @@ -560,7 +561,9 @@ For example, the following command: [source, shell] ---- -bin/neo4j-admin database import full @/path/to/your/ mydb +bin/neo4j-admin database import full \ +@/path/to/your/ \ +databasename ---- For more information, see link:https://picocli.info/#AtFiles[Picocli -> AtFiles] official documentation. ==== @@ -615,9 +618,11 @@ The command does not write any data to the database. [source, shell, role=noplay] ---- -bin/neo4j-admin database import full --dry-run=true --nodes import/movies_header.csv,import/movies.csv \ ---nodes import/actors_header.csv,import/actors.csv \ ---relationships import/roles_header.csv,import/roles.csv +bin/neo4j-admin database import full \ +--dry-run=true \ +--nodes=import/movies_header.csv,import/movies.csv \ +--nodes=import/actors_header.csv,import/actors.csv \ +--relationships=import/roles_header.csv,import/roles.csv ---- .Example output @@ -663,9 +668,10 @@ The following command imports the three datasets: [source, shell, role=noplay] ---- -bin/neo4j-admin database import full --nodes import/movies_header.csv,import/movies.csv \ ---nodes import/actors_header.csv,import/actors.csv \ ---relationships import/roles_header.csv,import/roles.csv +bin/neo4j-admin database import full \ +--nodes=import/movies_header.csv,import/movies.csv \ +--nodes=import/actors_header.csv,import/actors.csv \ +--relationships=import/roles_header.csv,import/roles.csv ---- [[import-tool-multiple-input-files-regex-example]] @@ -679,7 +685,8 @@ For example: [source, shell, role=noplay] ---- -bin/neo4j-admin database import full --nodes import/node_header.csv,import/node_data_\d+\.csv +bin/neo4j-admin database import full \ +--nodes=import/node_header.csv,import/node_data_\d+\.csv ---- [NOTE] @@ -697,7 +704,9 @@ For example: [source, shell, role=noplay] ---- -bin/neo4j-admin database import full --nodes import/node_header.csv,'import/node_data_\d{1,5}.csv' databasename +bin/neo4j-admin database import full \ +--nodes=import/node_header.csv,'import/node_data_\d{1,5}.csv' \ +databasename ---- [[import-files-from-cloud-storage]] @@ -722,7 +731,10 @@ The example assumes that you have data stored in the `myBucket/data` folder in y + [source, shell, role=noplay] ---- -bin/neo4j-admin database import full --nodes s3://myBucket/data/nodes.csv --relationships s3://myBucket/data/relationships.csv newdb +bin/neo4j-admin database import full \ +--nodes=s3://myBucket/data/nodes.csv \ +--relationships=s3://myBucket/data/relationships.csv \ +databasename ---- ====== @@ -736,7 +748,10 @@ The example assumes that you have data stored in the `myBucket/data` folder in y + [source,shell] ---- -bin/neo4j-admin database import full --nodes gs://myBucket/data/nodes.csv --relationships gs://myBucket/data/relationships.csv newdb +bin/neo4j-admin database import full \ +--nodes=gs://myBucket/data/nodes.csv \ +--relationships=gs://myBucket/data/relationships.csv \ +databasename ---- ====== @@ -750,7 +765,10 @@ The example assumes that you have data stored in the `myStorageAccount/myContain + [source,shell] ---- -bin/neo4j-admin database import full --nodes azb://myStorageAccount/myContainer/data/nodes.csv --relationships azb://myStorageAccount/myContainer/data/relationships.csv newdb +bin/neo4j-admin database full \ +--nodes=azb://myStorageAccount/myContainer/data/nodes.csv \ +--relationships=azb://myStorageAccount/myContainer/data/relationships.csv \ +databasename ---- ====== ===== @@ -1264,7 +1282,11 @@ The command does not write any data to the database. ---- neo4j@system> STOP DATABASE neo4j WAIT; ... -bin/neo4j-admin database import incremental --dry-run=true --nodes=N1=../../raw-data/incremental-import/nodes.csv --relationships=R1=../../raw-data/incremental-import/relationships.csv neo4j +bin/neo4j-admin database import incremental \ +--dry-run=true \ +--nodes=N1=../../raw-data/incremental-import/nodes.csv \ +--relationships=R1=../../raw-data/incremental-import/relationships.csv \ +neo4j ---- .Example output @@ -1314,7 +1336,11 @@ This option requires the database to be stopped. ---- neo4j@system> STOP DATABASE neo4j WAIT; ... -bin/neo4j-admin database import incremental --stage=all --nodes=N1=../../raw-data/incremental-import/nodes.csv --relationships=R1=../../raw-data/incremental-import/relationships.csv neo4j +bin/neo4j-admin database import incremental \ +--stage=all \ +--nodes=N1=../../raw-data/incremental-import/nodes.csv \ +--relationships=R1=../../raw-data/incremental-import/relationships.csv \ +neo4j ---- [[incremental-import-stages]] @@ -1338,7 +1364,11 @@ STOP DATABASE neo4j WAIT + [source, shell, role=noplay] ---- -bin/neo4j-admin database import incremental --stage=prepare --nodes=N1=../../raw-data/incremental-import/nodes.csv --relationships=R1=../../raw-data/incremental-import/relationships.csv neo4j +bin/neo4j-admin database import incremental \ +--stage=prepare \ +--nodes=N1=../../raw-data/incremental-import/nodes.csv \ +--relationships=R1=../../raw-data/incremental-import/relationships.csv \ +neo4j ---- . `build` stage: + @@ -1356,7 +1386,11 @@ ALTER DATABASE neo4j SET ACCESS READ ONLY + [source, shell, role=noplay] ---- -bin/neo4j-admin database import incremental --stage=build --nodes=N1=../../raw-data/incremental-import/nodes.csv --relationships=R1=../../raw-data/incremental-import/relationships.csv neo4j +bin/neo4j-admin database import incremental \ +--stage=build \ +--nodes=N1=../../raw-data/incremental-import/nodes.csv \ +--relationships=R1=../../raw-data/incremental-import/relationships.csv \ +neo4j ---- . `merge` stage: + @@ -1375,7 +1409,9 @@ STOP DATABASE neo4j WAIT + [source, shell, role=noplay] ---- -bin/neo4j-admin database import incremental --stage=merge neo4j +bin/neo4j-admin database import incremental \ +--stage=merge \ +neo4j ---- [[import-tool-header-format]] @@ -2095,7 +2131,10 @@ For example: [source, shell, role=noplay] ---- -bin/neo4j-admin database import full --nodes import/node_header.csv,import/node_data.csv --multiline-fields=true databasename +bin/neo4j-admin database import full \ +--nodes=import/node_header.csv,import/node_data.csv \ +--multiline-fields=true \ +databasename ---- Where `import/node_data.csv` contains multiline fields, such as: @@ -2131,7 +2170,11 @@ For example: ====== [source, shell, role=noplay] ---- -bin/neo4j-admin database import full --nodes import/node_header.csv,import/node_data.csv --multiline-fields=true --multiline-fields-format=v1 databasename +bin/neo4j-admin database import full \ +--nodes=import/node_header.csv,import/node_data.csv \ +--multiline-fields=true \ +--multiline-fields-format=v1 \ +databasename ---- Where `import/node_data.csv` contains multiline fields, such as: @@ -2148,7 +2191,11 @@ description [source, shell, role=noplay] ---- -bin/neo4j-admin database import full --nodes import/node_header.csv,import/node_data.csv --multiline-fields=import/node_data.csv --multiline-fields-format=v2 databasename +bin/neo4j-admin database import full \ +--nodes=import/node_header.csv,import/node_data.csv \ +--multiline-fields=import/node_data.csv \ +--multiline-fields-format=v2 \ +databasename ---- Where `import/node_data.csv` contains multiline fields, such as: @@ -2208,7 +2255,10 @@ actors-header.csv actors.csv.zip movies-header.csv movies.csv.gz roles-heade [source, sh] ---- -bin/neo4j-admin database import full --nodes import/movies-header.csv,import/movies.csv.gz --nodes import/actors-header.csv,import/actors.csv.zip --relationships import/roles-header.csv,import/roles.csv.gz +bin/neo4j-admin database import full \ +--nodes=import/movies-header.csv,import/movies.csv.gz \ +--nodes=import/actors-header.csv,import/actors.csv.zip \ +--relationships=import/roles-header.csv,import/roles.csv.gz ---- ==== @@ -2325,7 +2375,12 @@ Then, use the following example commands to run the import: [source, shell, role=noplay] ---- -bin/neo4j-admin database import full neo4j --nodes=import/movies.csv --nodes=import/actors.csv --relationships=import/roles.csv --schema=import/schema.cypher +bin/neo4j-admin database import full \ +--nodes=import/movies.csv \ +--nodes=import/actors.csv \ +--relationships=import/roles.csv \ +--schema=import/schema.cypher \ +neo4j ---- [role=label--new-2026.02] @@ -2395,7 +2450,12 @@ Then, use the following example commands to run the import: [source, shell, role=noplay] ---- -bin/neo4j-admin database import incremental --stage=all --nodes=import/movies.csv --nodes=import/actors.csv --relationships=import/roles.csv --schema=import/schema.cypher +bin/neo4j-admin database import incremental \ +--stage=all \ +--nodes=import/movies.csv \ +--nodes=import/actors.csv \ +--relationships=import/roles.csv \ +--schema=import/schema.cypher ---- [role=label--enterprise-edition] @@ -2421,9 +2481,10 @@ For example: .Run a full import with JFR recording [source, shell, role=noplay] ---- -bin/neo4j-admin database import full --nodes import/movies_header.csv,import/movies.csv \ ---nodes import/actors_header.csv,import/actors.csv \ ---relationships import/roles_header.csv,import/roles.csv \ +bin/neo4j-admin database import full \ +--nodes=import/movies_header.csv,import/movies.csv \ +--nodes=import/actors_header.csv,import/actors.csv \ +--relationships=import/roles_header.csv,import/roles.csv \ --profile=true ---- diff --git a/modules/ROOT/pages/tutorial/index.adoc b/modules/ROOT/pages/tutorial/index.adoc index a888a5ec8a..8cff77e9aa 100644 --- a/modules/ROOT/pages/tutorial/index.adoc +++ b/modules/ROOT/pages/tutorial/index.adoc @@ -7,7 +7,7 @@ The following step-by-step tutorials cover common operational tasks or otherwise //* <> -- This tutorial walks through the basics of setting up a Neo4j Causal Cluster. //* <> -- This tutorial provides a detailed example of how to back up and restore a database in a running Causal Cluster. -* xref:tutorial/neo4j-admin-import.adoc[Importing data] -- This tutorial provides detailed examples to illustrate the capabilities of importing data from CSV files with the command `neo4j-admin database import`. +* xref:tutorial/neo4j-admin-import.adoc[Full data import] -- Examples of importing data from CSV files using the `neo4j-admin database import full` command. * xref:tutorial/tutorial-composite-database.adoc[Setting up and using a composite database] -- This tutorial walks through the basics of setting up and using Composite databases. * xref:tutorial/access-control.adoc[Fine-grained access control] -- This tutorial presents an example that illustrates various aspects of security and fine-grained access control. * xref:tutorial/tutorial-sso-configuration.adoc[Configuring Neo4j Single Sign-On (SSO)] -- Examples and solutions to common problems when configuring SSO. diff --git a/modules/ROOT/pages/tutorial/neo4j-admin-import.adoc b/modules/ROOT/pages/tutorial/neo4j-admin-import.adoc index a8dd5d9bd6..109c8db7a3 100644 --- a/modules/ROOT/pages/tutorial/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tutorial/neo4j-admin-import.adoc @@ -1,48 +1,50 @@ [[tutorial-neo4j-admin-import]] -= Importing data -:description: This tutorial provides detailed examples to illustrate the capabilities of importing data from CSV files with the command `neo4j-admin database import`. += Full data import +:description: Examples of importing data from CSV files using the `neo4j-admin database import full` command. -This tutorial provides detailed examples to illustrate the capabilities of importing data from CSV files with the command xref:import.adoc[`neo4j-admin database import`]. -The import command is used for loading large amounts of data from CSV files and supports full and incremental import into a running or stopped Neo4j DBMS. +The neo4j-admin import command is used for loading large amounts of data from CSV files and supports full and incremental import into a running or stopped DBMS. + +This page provides examples of importing data from CSV files into a nonexistent database using the xref:import.adoc#import-tool-full[`neo4j-admin database import full`] command. + +For examples of importing data into an existing database using the `neo4j-admin database import incremental` command, see xref:import.adoc#import-tool-incremental[Incremental import]. [IMPORTANT] ==== -The `neo4j-admin database import` command does not create a database, the command only imports data and makes it available for the database. -The database must not exist before the `neo4j-admin database import` command has been executed, and the database should be created afterward. -The command will exit with an error message if the database already exists. +The `neo4j-admin database import full` command does not create a database, the command only imports data and makes it available for the database. + +If the database does not exist before running the command, you must create it afterward. + +If you want to perform a full import into an existing database, you must stop the database before running the command and specify the `--overwrite-destination` flag to overwrite the existing database. +Then, you can start the database and the imported data will be available for querying. ==== -Relationships are created by connecting node IDs, each node should have a unique ID to be able to be referenced when creating relationships between nodes. -In the following examples, the node IDs are stored as properties on the nodes. -If you do not want the IDs to persist as properties after the import completes, then do not specify a property name in the `:ID` field. -//Investigate the :ID field vs. id(node) function +== Prerequisites -The examples show how to import data in a standalone Neo4j DBMS. +The following examples show how to import data into a nonexistent database in a standalone Neo4j DBMS. They use: * The Neo4j tarball (xref:installation/linux/tarball.adoc#unix-console[Unix console application]). * `$NEO4J_HOME` as the current working directory. -* The default database `neo4j`. +* A nonexistent database, called `foo`. * The _import_ directory of the Neo4j installation to store all the CSV files. However, the CSV files can be located in any directory of your file system. * UNIX-styled paths. -* The xref:import.adoc[`neo4j-admin database import full`] command. - -//To create a cluster based on imported data, see <>. +* The xref:import.adoc#import-tool-full[`neo4j-admin database import full`] command. [TIP] .Handy tips: ==== -* The details of a CSV file header format can be found at xref:import.adoc#import-tool-header-format[CSV header format]. -* To show available databases, use the Cypher query `SHOW DATABASES`. -* To remove a database, use the Cypher query `DROP DATABASE database_name`. -* To create a database, use the Cypher query `CREATE DATABASE database_name`. -==== +Relationships are created by connecting node IDs. +Therefore, each node must have a unique ID to be able to be referenced when creating relationships between nodes. +In the following examples, the node IDs are stored as properties on the nodes. +If you do not want the IDs to persist as properties after the import completes, then do not specify a property name in the `:ID` field. +The details of a CSV file header format can be found at xref:import.adoc#import-tool-header-format[CSV header format]. +==== -== Import a small data set +== Example 1: Import a small data set -In this example, you will import a small data set containing nodes and relationships. +The following example imports a small data set containing nodes and relationships. The data set is split into three CSV files, where each file has a header row describing the data. [discrete] @@ -53,17 +55,17 @@ Data for movies and actors are stored as nodes and the roles are stored as relat The files you want to import data from are: -* `movies.csv` -* `actors.csv` -* `roles.csv` +* _movies.csv_ +* _actors.csv_ +* _roles.csv_ -Each movie in `movies.csv` has an `ID`, a `title`, and a `year`, stored as **properties** in the node. -All the nodes in `movies.csv` also have the **label** `Movie`. -A node can have several labels, as you can see in `movies.csv` there are nodes that also have the label `Sequel`. -The node labels are optional, they are very useful for grouping nodes into sets where all nodes that have a certain label belong to the same set. +Each movie in _movies.csv_ has an `ID`, a `title`, and a `year`, stored as **properties** in the node. +All the nodes in _movies.csv_ also have the **label** `Movie`. +A node can have several labels, as you can see in _movies.csv_, there are nodes that also have the label `Sequel`. +The node labels are optional, they are very useful for grouping nodes into sets, where all nodes that have a certain label belong to the same set. .movies.csv -[source] +[source, csv] ---- movieId:ID,title,year:int,:LABEL tt0133093,"The Matrix",1999,Movie @@ -71,12 +73,12 @@ tt0234215,"The Matrix Reloaded",2003,Movie;Sequel tt0242653,"The Matrix Revolutions",2003,Movie;Sequel ---- -The actors' data in `actors.csv` consist of an `ID` and a `name`, stored as **properties** in the node. -The ID in this case is a shorthand for the actor's name. -All the nodes in `actors.csv` have the label `Actor`. +The actors' data in _actors.csv_ consist of an `ID` and a `name`, stored as **properties** in the node. +The ID, in this case, is a shorthand for the actor's name. +All the nodes in _actors.csv_ have the label `Actor`. .actors.csv -[source] +[source, csv] ---- personId:ID,name,:LABEL keanu,"Keanu Reeves",Actor @@ -84,20 +86,20 @@ laurence,"Laurence Fishburne",Actor carrieanne,"Carrie-Anne Moss",Actor ---- -The roles data in `roles.csv` have only one **property**, `role`. +The roles data in _roles.csv_ have only one **property**, `role`. Roles are represented by relationship data that connects actor nodes with movie nodes. There are three mandatory fields for relationship data: -. `:START_ID` -- ID referring to a node. -. `:END_ID` -- ID referring to a node. -. `:TYPE` -- The relationship type. +* `:START_ID` -- ID referring to a node. +* `:END_ID` -- ID referring to a node. +* `:TYPE` -- The relationship type. -To create a relationship between two nodes, the IDs defined in `actors.csv` and `movies.csv` are used for the `:START_ID` and `:END_ID` fields. +To create a relationship between two nodes, the IDs defined in _actors.csv_ and _movies.csv_ are used for the `:START_ID` and `:END_ID` fields. You also need to provide a relationship type (in this case `ACTED_IN`) for the `:TYPE` field. .roles.csv -[source] +[source, csv] ---- :START_ID,role,:END_ID,:TYPE keanu,"Neo",tt0133093,ACTED_IN @@ -115,53 +117,25 @@ carrieanne,"Trinity",tt0242653,ACTED_IN [discrete] === Importing the data -* Paths to node data are defined with the `--nodes` option. -* Paths to relationship data is defined with the `--relationships` option. - -The call to `neo4j-admin database import` would look like this: - -.shell -[source] ----- -bin/neo4j-admin database import full neo4j --nodes=import/movies.csv --nodes=import/actors.csv --relationships=import/roles.csv ----- - - -[discrete] -=== Query the data - -To query the data. -Start Neo4j. - -[NOTE] -==== -The default username and password are `neo4j` and `neo4j`. -==== - -.shell -[source] ----- -bin/neo4j start ----- - -To query the imported data in the graph, try a simple Cypher query. +You can import the data from the CSV files into the database `foo` with a single command. +The database `foo` should not exist and it must be created afterward. +Paths to node data are defined with the `--nodes` option. +Paths to relationship data are defined with the `--relationships` option. -.shell -[source] ----- -bin/cypher-shell --database=neo4j "MATCH (n) RETURN count(n) as nodes" ----- +include::partial$/full-import-drop-db.adoc[] -Stop Neo4j. - -.shell -[source] +. In a separate terminal, run the `neo4j-admin database import full` command to import the data from the CSV files: ++ +[source, shell] ---- -bin/neo4j stop +bin/neo4j-admin database import full foo \ +--nodes=import/movies.csv \ +--nodes=import/actors.csv \ +--relationships=import/roles.csv ---- +include::partial$/full-import-query-db.adoc[] - -== CSV file delimiters +== Example 2: CSV file delimiters You can customize the configuration options that the import tool uses (see xref:import.adoc#_options[Options]) if your data does not fit the default format. @@ -178,7 +152,7 @@ The following CSV files have: * `--quote="'"` .movies2.csv -[source] +[source, csv] ---- movieId:ID;title;year:int;:LABEL tt0133093;'The Matrix';1999;Movie @@ -187,7 +161,7 @@ tt0242653;'The Matrix Revolutions';2003;Movie|Sequel ---- .actors2.csv -[source] +[source, csv] ---- personId:ID;name;:LABEL keanu;'Keanu Reeves';Actor @@ -196,7 +170,7 @@ carrieanne;'Carrie-Anne Moss';Actor ---- .roles2.csv -[source] +[source, csv] ---- :START_ID;role;:END_ID;:TYPE keanu;'Neo';tt0133093;ACTED_IN @@ -214,16 +188,29 @@ carrieanne;'Trinity';tt0242653;ACTED_IN [discrete] === Importing the data -The call to `neo4j-admin database import` would look like this: +You import the data from the CSV files into the database `foo` with a single command. +The database `foo` should not exist and it must be created afterward. +Paths to node data are defined with the `--nodes` option. +Paths to relationship data are defined with the `--relationships` option. -.shell -[source] +include::partial$/full-import-drop-db.adoc[] + +. In a separate terminal, run the `neo4j-admin database import full` command to import the data from the CSV files: ++ +[source, shell] ---- -bin/neo4j-admin database import full neo4j --delimiter=";" --array-delimiter="U+007C" --quote="'" --nodes=import/movies2.csv --nodes=import/actors2.csv --relationships=import/roles2.csv +bin/neo4j-admin database import full foo \ +--delimiter=";" \ +--array-delimiter="U+007C" \ +--quote="'" \ +--nodes=import/movies2.csv \ +--nodes=import/actors2.csv \ +--relationships=import/roles2.csv ---- +include::partial$/full-import-query-db.adoc[] -== Using separate header files +== Example 3: Using separate header files When dealing with very large CSV files, it is more convenient to have the header in a separate file. This makes it easier to edit the header as you avoid having to open a huge data file just to change it. @@ -238,16 +225,16 @@ The import tool can also process single-file compressed archives, for example: [discrete] === The data -You will use the same data set as in the previous example but with the headers in separate files. +You will use the same data set as in the previous examples but with the headers in separate files. .movies3-header.csv -[source] +[source, csv] ---- movieId:ID,title,year:int,:LABEL ---- .movies3.csv -[source] +[source, csv] ---- tt0133093,"The Matrix",1999,Movie tt0234215,"The Matrix Reloaded",2003,Movie;Sequel @@ -255,13 +242,13 @@ tt0242653,"The Matrix Revolutions",2003,Movie;Sequel ---- .actors3-header.csv -[source] +[source, csv] ---- personId:ID,name,:LABEL ---- .actors3.csv -[source] +[source, csv] ---- keanu,"Keanu Reeves",Actor laurence,"Laurence Fishburne",Actor @@ -269,13 +256,13 @@ carrieanne,"Carrie-Anne Moss",Actor ---- .roles3-header.csv -[source] +[source, csv] ---- :START_ID,role,:END_ID,:TYPE ---- .roles3.csv -[source] +[source, csv] ---- keanu,"Neo",tt0133093,ACTED_IN keanu,"Neo",tt0234215,ACTED_IN @@ -292,76 +279,85 @@ carrieanne,"Trinity",tt0242653,ACTED_IN [discrete] === Importing the data -The call to `neo4j-admin database import` would look as follows: +You import the data from the CSV files into the database `foo` with a single command. +The database `foo` should not exist and it must be created afterward. +Paths to node data are defined with the `--nodes` option. +Paths to relationship data are defined with the `--relationships` option. + +include::partial$/full-import-drop-db.adoc[] +. In a separate terminal, run the `neo4j-admin database import full` command to import the data from the CSV files: ++ [NOTE] ==== The header line for a file group, whether it is the first line of a file in the group or a dedicated header file, must be the _first_ line in the file group. ==== - -.shell -[source] ++ +[source, shell] ---- -bin/neo4j-admin database import full neo4j --nodes=import/movies3-header.csv,import/movies3.csv --nodes=import/actors3-header.csv,import/actors3.csv --relationships=import/roles3-header.csv,import/roles3.csv +bin/neo4j-admin database import full foo \ +--nodes=import/movies3-header.csv,import/movies3.csv \ +--nodes=import/actors3-header.csv,import/actors3.csv \ +--relationships=import/roles3-header.csv,import/roles3.csv ---- +include::partial$/full-import-query-db.adoc[] - -== Multiple input files +[[example-multiple-input-files]] +== Example 4: Multiple input files In addition to using a separate header file, you can also provide multiple node or relationship files. Files within such an input group can be specified with multiple match strings, delimited by `,`, where each matched string can be either the exact file name or a regular expression matching one or more files. -Multiple matching files will be sorted according to their characters and their natural number sort order for file names containing numbers. - +Multiple matching files are sorted according to their characters and their natural number sort order for file names containing numbers. [discrete] === The data .movies4-header.csv -[source] +[source, csv] ---- movieId:ID,title,year:int,:LABEL ---- .movies4-part1.csv -[source] +[source, csv] ---- tt0133093,"The Matrix",1999,Movie tt0234215,"The Matrix Reloaded",2003,Movie;Sequel ---- .movies4-part2.csv -[source] +[source, csv] ---- tt0242653,"The Matrix Revolutions",2003,Movie;Sequel ---- .actors4-header.csv -[source] +[source, csv] ---- personId:ID,name,:LABEL ---- .actors4-part1.csv -[source] +[source, csv] ---- keanu,"Keanu Reeves",Actor laurence,"Laurence Fishburne",Actor ---- .actors4-part2.csv -[source] +[source, csv] ---- carrieanne,"Carrie-Anne Moss",Actor ---- .roles4-header.csv -[source] +[source, csv] ---- :START_ID,role,:END_ID,:TYPE ---- .roles4-part1.csv -[source] +[source, csv] ---- keanu,"Neo",tt0133093,ACTED_IN keanu,"Neo",tt0234215,ACTED_IN @@ -371,7 +367,7 @@ laurence,"Morpheus",tt0234215,ACTED_IN ---- .roles4-part2.csv -[source] +[source, csv] ---- laurence,"Morpheus",tt0242653,ACTED_IN carrieanne,"Trinity",tt0133093,ACTED_IN @@ -383,47 +379,74 @@ carrieanne,"Trinity",tt0242653,ACTED_IN [discrete] === Importing the data -The call to `neo4j-admin database import` would look like this: +You import the data from the CSV files into the database `foo` with a single command. +The database `foo` should not exist and it must be created afterward. +Paths to node data are defined with the `--nodes` option. +Paths to relationship data are defined with the `--relationships` option. -.shell -[source] +include::partial$/full-import-drop-db.adoc[] + +. In a separate terminal, run the `neo4j-admin database import full` command to import the data from the CSV files: ++ +[NOTE] +==== +The header line for a file group, whether it is the first line of a file in the group or a dedicated header file, must be the _first_ line in the file group. +==== ++ +[source, shell] ---- -bin/neo4j-admin database import full neo4j --nodes=import/movies4-header.csv,import/movies4-part1.csv,import/movies4-part2.csv --nodes=import/actors4-header.csv,import/actors4-part1.csv,import/actors4-part2.csv --relationships=import/roles4-header.csv,import/roles4-part1.csv,import/roles4-part2.csv +bin/neo4j-admin database import full foo \ +--nodes=import/movies4-header.csv,import/movies4-part1.csv,import/movies4-part2.csv \ +--nodes=import/actors4-header.csv,import/actors4-part1.csv,import/actors4-part2.csv \ +--relationships=import/roles4-header.csv,import/roles4-part1.csv,import/roles4-part2.csv ---- +include::partial$/full-import-query-db.adoc[] -[discrete] -=== Regular expressions +== Example 5: Regular expressions File names can be specified using regular expressions when there are many data source files. Each file name that matches the regular expression will be included. -If using separate header files, for the import to work correctly, the header file must be the first in the file group. When using regular expressions to specify the input files, the list of files will be sorted according to the names of the files that match the expression. The matching is aware of the numbers inside the file names and will sort them accordingly, without the need for padding with zeros. -.Match order -==== -For example, let's assume that you have the following files: -* `movies4-header.csv` -* `movies4-data1.csv` -* `movies4-data2.csv` -* `movies4-data12.csv` +[discrete] +=== The data + +Let's assume that you have the same files as in <>. If you use the regular expression `+movies4.*+`, the sorting will place the header file last and the import will fail. A better alternative would be to name the header file explicitly and use a regular expression that only matches the names of the data files. -For example: `+--nodes "import/movies4-header.csv,movies-data.*"+` will accomplish this. -==== +For example: `+--nodes "import/movies4-header.csv,movies4-part.*"+` will accomplish this. + -Importing the data using regular expressions, the call to `neo4j-admin database import` can be simplified to: +[discrete] +=== Importing the data + +You import the data from the CSV files into the database `foo` with a single command. +The database `foo` should not exist and it must be created afterward. +Paths to node data are defined with the `--nodes` option. +Paths to relationship data are defined with the `--relationships` option. + +include::partial$/full-import-drop-db.adoc[] -.shell -[source] +. In a separate terminal, run the `neo4j-admin database import full` command to import the data from the CSV files: ++ +[NOTE] +==== +The header line for a file group, whether it is the first line of a file in the group or a dedicated header file, must be the _first_ line in the file group. +==== ++ +[source, shell] ---- -bin/neo4j-admin database import full neo4j --nodes="import/movies4-header.csv,import/movies4-part.*" --nodes="import/actors4-header.csv,import/actors4-part.*" --relationships="import/roles4-header.csv,import/roles4-part.*" +bin/neo4j-admin database import full foo \ +--nodes="import/movies4-header.csv,import/movies4-part.*" \ +--nodes="import/actors4-header.csv,import/actors4-part.*" \ +--relationships="import/roles4-header.csv,import/roles4-part.*" ---- - ++ [NOTE] ==== The use of regular expressions should not be confused with https://en.wikipedia.org/wiki/Glob_(programming)[file globbing]. @@ -433,22 +456,21 @@ Therefore, the regular expression `+movies4.*+` will list all files starting wit Conversely, with file globbing, `+ls movies4.*+` will list all files starting with `movies4.`. Another important difference to pay attention to is the sorting order. -The result of a regular expression matching will place the file `movies4-part2.csv` before the file `movies4-part12.csv`. -If doing `+ls movies4-part*+` in a directory containing the above-listed files, the file `movies4-part12.csv` will be listed before the file `movies4-part2.csv`. +The result of a regular expression matching will place the file `movies4-part2.csv` before the file `movies4-partX.csv`. +If doing `+ls movies4-part*+` in a directory containing the above-listed files, the file `movies4-partX.csv` will be listed before the file `movies4-part2.csv`. ==== +include::partial$/full-import-query-db.adoc[] -== Using the same label for every node +== Example 6: Using the same label for every node -If you want to use the same node label(s) for every node in your nodes file you can do this by specifying the appropriate value as an option to `neo4j-admin database import`. -There is then no need to specify the `:LABEL` column in the header file and each row (node) will apply the specified labels from the command line option. +If you want to use the same node label(s) for every node in your nodes file, you can specify the appropriate value as an option to `neo4j-admin database import full`. +There is then no need to specify the `:LABEL` column in the header file, and each row (node) will apply the specified labels from the command line option. +For example, you can use the following syntax to specify node labels option: -.Specify node labels option -==== `--nodes=LabelOne:LabelTwo=import/example-header.csv,import/example-data1.csv` -==== -[NOTE] +[TIP] ==== It is possible to apply both the label provided in the file and the one provided on the command line to the node. ==== @@ -460,14 +482,14 @@ It is possible to apply both the label provided in the file and the one provided In this example, you want to have the label `Movie` on every node specified in `movies5a.csv`, and you put the labels `Movie` and `Sequel` on the nodes specified in `sequels5a.csv`. .movies5a.csv -[source] +[source, csv] ---- movieId:ID,title,year:int tt0133093,"The Matrix",1999 ---- .sequels5a.csv -[source] +[source, csv] ---- movieId:ID,title,year:int tt0234215,"The Matrix Reloaded",2003 @@ -475,7 +497,7 @@ tt0242653,"The Matrix Revolutions",2003 ---- .actors5a.csv -[source] +[source, csv] ---- personId:ID,name keanu,"Keanu Reeves" @@ -484,7 +506,7 @@ carrieanne,"Carrie-Anne Moss" ---- .roles5a.csv -[source] +[source, csv] ---- :START_ID,role,:END_ID,:TYPE keanu,"Neo",tt0133093,ACTED_IN @@ -502,24 +524,32 @@ carrieanne,"Trinity",tt0242653,ACTED_IN [discrete] === Importing the data -The call to `neo4j-admin database import` would look like this: +You import the data from the CSV files into the database `foo` with a single command. +The database `foo` should not exist and it must be created afterward. +Paths to node data are defined with the `--nodes` option. +Paths to relationship data are defined with the `--relationships` option. + +include::partial$/full-import-drop-db.adoc[] -.shell -[source] +. In a separate terminal, run the `neo4j-admin database import full` command to import the data from the CSV files: ++ +[source, shell] ---- -bin/neo4j-admin database import full neo4j --nodes=Movie=import/movies5a.csv --nodes=Movie:Sequel=import/sequels5a.csv --nodes=Actor=import/actors5a.csv --relationships=import/roles5a.csv +bin/neo4j-admin database import full foo \ +--nodes=Movie=import/movies5a.csv \ +--nodes=Movie:Sequel=import/sequels5a.csv \ +--nodes=Actor=import/actors5a.csv \ +--relationships=import/roles5a.csv ---- +include::partial$/full-import-query-db.adoc[] -== Using the same relationship type for every relationship +== Example 7: Using the same relationship type for every relationship If you want to use the same relationship type for every relationship in your relationships file this can be done by specifying the appropriate value as an option to `neo4j-admin database import`. +For example, you can use the following syntax to specify relationship type option: - -.Specify relationship type option -==== `--relationships=TYPE=import/example-header.csv,import/example-data1.csv` -==== [NOTE] ==== @@ -532,7 +562,7 @@ If you provide a relationship type both on the command line and in the relations In this example, you want the relationship type `ACTED_IN` to be applied on every relationship specified in `roles5b.csv`. .movies5b.csv -[source] +[source, csv] ---- movieId:ID,title,year:int,:LABEL tt0133093,"The Matrix",1999,Movie @@ -541,7 +571,7 @@ tt0242653,"The Matrix Revolutions",2003,Movie;Sequel ---- .actors5b.csv -[source] +[source, csv] ---- personId:ID,name,:LABEL keanu,"Keanu Reeves",Actor @@ -550,7 +580,7 @@ carrieanne,"Carrie-Anne Moss",Actor ---- .roles5b.csv -[source] +[source, csv] ---- :START_ID,role,:END_ID keanu,"Neo",tt0133093 @@ -568,16 +598,26 @@ carrieanne,"Trinity",tt0242653 [discrete] === Importing the data -The call to `neo4j-admin database import` would look like this: +You import the data from the CSV files into the database `foo` with a single command. +The database `foo` should not exist and it must be created afterward. +Paths to node data are defined with the `--nodes` option. +Paths to relationship data are defined with the `--relationships` option. + +include::partial$/full-import-drop-db.adoc[] -.shell -[source] +. In a separate terminal, run the `neo4j-admin database import full` command to import the data from the CSV files: ++ +[source, shell] ---- -bin/neo4j-admin database import full neo4j --nodes=import/movies5b.csv --nodes=import/actors5b.csv --relationships=ACTED_IN=import/roles5b.csv +bin/neo4j-admin database import full foo \ +--nodes=import/movies5b.csv \ +--nodes=import/actors5b.csv \ +--relationships=ACTED_IN=import/roles5b.csv ---- +include::partial$/full-import-query-db.adoc[] -== Properties +== Example 8: Properties Nodes and relationships can have properties. The property type is specified in the CSV header row, see xref:import.adoc#import-tool-header-format[CSV header format]. @@ -591,21 +631,21 @@ The following example creates a small graph containing one actor and one movie c There is a `roles` property on the relationship which contains an array of the characters played by the actor in a movie: .movies6.csv -[source] +[source, csv] ---- movieId:ID,title,year:int,:LABEL tt0099892,"Joe Versus the Volcano",1990,Movie ---- .actors6.csv -[source] +[source, csv] ---- personId:ID,name,:LABEL meg,"Meg Ryan",Actor ---- .roles6.csv -[source] +[source, csv] ---- :START_ID,roles:string[],:END_ID,:TYPE meg,"DeDe;Angelica Graynamore;Patricia Graynamore",tt0099892,ACTED_IN @@ -615,16 +655,48 @@ meg,"DeDe;Angelica Graynamore;Patricia Graynamore",tt0099892,ACTED_IN [discrete] === Importing the data -The call to `neo4j-admin database import` would look like this: +You import the data from the CSV files into the database `foo` with a single command. +The database `foo` should not exist and it must be created afterward. +Paths to node data are defined with the `--nodes` option. +Paths to relationship data are defined with the `--relationships` option. + +include::partial$/full-import-drop-db.adoc[] + +. In a separate terminal, run the `neo4j-admin database import full` command to import the data from the CSV files: ++ +[source, shell] +---- +bin/neo4j-admin database import full foo \ +--nodes=import/movies6.csv \ +--nodes=import/actors6.csv \ +--relationships=import/roles6.csv +---- + +. In your Cypher Shell terminal, create the database `foo`: ++ +[source, cypher] +---- +CREATE DATABASE foo; +---- -.shell -[source] +. Switch to the `foo` database: ++ +[source, cypher] ---- -bin/neo4j-admin database import full neo4j --nodes=import/movies6.csv --nodes=import/actors6.csv --relationships=import/roles6.csv +:use foo; ---- +. Run a Cypher query to check that the data has been imported correctly: ++ +[source, cypher] +---- +MATCH (n) +RETURN count(n) as nodes; +---- ++ +This query returns `2` as there are 2 nodes in the graph (1 movie and 1 actor). -== ID space +== Example 9: ID space The import tool assumes that identifiers are unique across node files. This may not be the case for data sets that use sequential, auto-incremented, or otherwise colliding identifiers. @@ -633,27 +705,24 @@ Those data sets can define ID spaces where identifiers are unique within their r In cases where the node ID is unique only within files, using ID spaces is a way to ensure uniqueness across all node files. See xref:import.adoc#import-tool-id-spaces[Using ID spaces]. -Each node processed by `neo4j-admin database import` must provide an ID if it is to be connected in any relationships. +Each node processed by `neo4j-admin database import full` must provide an ID if it is to be connected in any relationships. The node ID is used to find the start node and end node when creating a relationship. A node header can also contain multiple `ID` columns, where the relationship data references the composite value of all those columns. This also implies using `string` as `id-type`. For each `ID` column, you can specify to store its values as different node properties. However, the composite value cannot be stored as a node property. +For example, you can use the following syntax to define the ID space `Movie-ID` for `movieId:ID`: -.ID space -==== -To define an ID space `Movie-ID` for `movieId:ID`, use the syntax `movieId:ID(Movie-ID)`. -==== - +`movieId:ID(Movie-ID)`. [discrete] === The data -For example, if movies and people both use sequential identifiers, then you would define `Movie` and `Actor` ID spaces. +If both movies and people use sequential identifiers, then you need to define `Movie` and `Actor` ID spaces. .movies7.csv -[source] +[source, csv] ---- movieId:ID(Movie-ID),title,year:int,:LABEL 1,"The Matrix",1999,Movie @@ -662,7 +731,7 @@ movieId:ID(Movie-ID),title,year:int,:LABEL ---- .actors7.csv -[source] +[source, csv] ---- personId:ID(Actor-ID),name,:LABEL 1,"Keanu Reeves",Actor @@ -673,7 +742,7 @@ personId:ID(Actor-ID),name,:LABEL You also need to reference the appropriate ID space in your relationships file so it knows which nodes to connect. .roles7.csv -[source] +[source, csv] ---- :START_ID(Actor-ID),role,:END_ID(Movie-ID) 1,"Neo",1 @@ -691,29 +760,34 @@ You also need to reference the appropriate ID space in your relationships file s [discrete] === Importing the data -The call to `neo4j-admin database import` would look like this: +You import the data from the CSV files into the database `foo` with a single command. +The database `foo` should not exist and it must be created afterward. +Paths to node data are defined with the `--nodes` option. +Paths to relationship data are defined with the `--relationships` option. -.shell -[source] +include::partial$/full-import-drop-db.adoc[] + +. In a separate terminal, run the `neo4j-admin database import full` command to import the data from the CSV files: ++ +[source, shell] ---- -bin/neo4j-admin database import full neo4j --nodes=import/movies7.csv --nodes=import/actors7.csv --relationships=ACTED_IN=import/roles7.csv +bin/neo4j-admin database import full foo \ +--nodes=import/movies7.csv \ +--nodes=import/actors7.csv \ +--relationships=ACTED_IN=import/roles7.csv ---- +include::partial$/full-import-query-db.adoc[] -== Skip relationships referring to missing nodes - -The import tool has no tolerance for bad entities (relationships or nodes) and will fail the import on the first bad entity. -You can specify explicitly that you want it to ignore rows that contain bad entities. +== Example 10: Skip relationships referring to missing nodes -There are two different types of bad input: +The import tool has no tolerance for bad relationships and will fail the import on the first bad relationship. +You can specify explicitly that you want it to ignore rows that contain bad relationships, and continue the import with the remaining data. -1. Bad relationships. -2. Bad nodes. - -Relationships that refer to missing node IDs, either for `:START_ID` or `:END_ID` are considered bad relationships. -Whether or not such relationships are skipped is controlled with the `--skip-bad-relationships` flag, which can have the values `true` or `false` or no value, which means `true`. +Bad relationships are relationships that refer to missing node IDs, either for `:START_ID` or `:END_ID`. +Whether or not such relationships are skipped is controlled with the `--skip-bad-relationships` flag, which can have the values `true` or `false`, or no value, which means `true`. The default is `false`, which means that any bad relationship is considered an error and will fail the import. -For more information, see the `--skip-bad-relationships` option. +For more information, see the `--skip-bad-relationships` option in xref:import.adoc#full-import-options-table[Import -> `neo4j-admin database import full` options] table. [discrete] @@ -722,7 +796,7 @@ For more information, see the `--skip-bad-relationships` option. In the following example, there is a missing `emil` node referenced in the roles file. .movies8a.csv -[source] +[source, csv] ---- movieId:ID,title,year:int,:LABEL tt0133093,"The Matrix",1999,Movie @@ -731,7 +805,7 @@ tt0242653,"The Matrix Revolutions",2003,Movie;Sequel ---- .actors8a.csv -[source] +[source, csv] ---- personId:ID,name,:LABEL keanu,"Keanu Reeves",Actor @@ -740,7 +814,7 @@ carrieanne,"Carrie-Anne Moss",Actor ---- .roles8a.csv -[source] +[source, csv] ---- :START_ID,role,:END_ID,:TYPE keanu,"Neo",tt0133093,ACTED_IN @@ -759,46 +833,57 @@ emil,"Emil",tt0133093,ACTED_IN [discrete] === Importing the data -The call to `neo4j-admin database import` would look like this: +You import the data from the CSV files into the database `foo` with a single command. +The database `foo` should not exist and it must be created afterward. +Paths to node data are defined with the `--nodes` option. +Paths to relationship data are defined with the `--relationships` option. + +include::partial$/full-import-drop-db.adoc[] -.shell -[source] +. In a separate terminal, run the `neo4j-admin database import full` command to import the data from the CSV files: ++ +[source, shell] ---- -bin/neo4j-admin database import full neo4j --nodes=import/movies8a.csv --nodes=import/actors8a.csv --relationships=import/roles8a.csv +bin/neo4j-admin database import full foo \ +--nodes=import/movies8a.csv \ +--nodes=import/actors8a.csv \ +--relationships=import/roles8a.csv ---- - ++ Because there is a bad relationship in the input data, the import process will fail. -Let's see what happens if you append the `--skip-bad-relationships` flag: - -.shell -[source] +. Let's see what happens if you append the `--skip-bad-relationships` flag: ++ +[source, shell] ---- -bin/neo4j-admin database import full neo4j --skip-bad-relationships --nodes=import/movies8a.csv --nodes=import/actors8a.csv --relationships=import/roles8a.csv +bin/neo4j-admin database import full foo \ +--skip-bad-relationships \ +--nodes=import/movies8a.csv \ +--nodes=import/actors8a.csv \ +--relationships=import/roles8a.csv +--overwrite-destination ---- +include::partial$/full-import-query-db.adoc[] ++ The data files are successfully imported and the bad relationship is ignored. -An entry is written to the `import.report` file. - +An entry is written to the `report.json.log` file for installations after 2026.03. +See xref:import.adoc#import-logs[Import progress reporting] for details. +For previous versions, see the `import.report` file. ++ .ignore bad relationships -[source] +[result, subs="attributes+,+macros"] ---- -InputRelationship: - source: roles8a.csv:11 - properties: [role, Emil] - startNode: emil (global id space) - endNode: tt0133093 (global id space) - type: ACTED_IN - referring to missing node emil +{"problem":"BadRelationship","message":"Invalid relationship in import data\n/path/to/neo4j-enterprise-{neo4j-version-exact}/import/roles8a.csv: line 10\n(emil:global id space)-[ACTED_IN]->(tt0133093:global id space) referring to missing node emil","source":"/path/to/neo4j-enterprise-{neo4j-version-exact}/import/roles8a.csv","line":10,"relationship":{"type":"ACTED_IN","source":{"id":"emil","group":null},"target":{"id":"tt0133093","group":null},"invalid":"emil"}} ---- -== Skip nodes with the same ID +== Example 11: Skip nodes with the same ID Nodes that specify `:ID`, which has already been specified within the ID space are considered bad nodes. -Whether or not such nodes are skipped is controlled with `--skip-duplicate-nodes` flag which can have the values `true` or `false` or no value, which means `true`. +Whether or not such nodes are skipped is controlled with `--skip-duplicate-nodes` flag, which can have the values `true`, `false`, or no value, which means `true`. The default is `false`, which means that any duplicate node is considered an error and will fail the import. -For more information, see the `--skip-duplicate-nodes` option. +For more information, see the `--skip-duplicate-nodes` option in xref:import.adoc#full-import-options-table[Import -> `neo4j-admin database import full` options] table. [discrete] @@ -806,8 +891,18 @@ For more information, see the `--skip-duplicate-nodes` option. In the following example there is a node ID, `laurence`, that is specified twice within the same ID space. + +.movies8b.csv +[source, csv] +---- +movieId:ID,title,year:int,:LABEL +tt0133093,"The Matrix",1999,Movie +tt0234215,"The Matrix Reloaded",2003,Movie;Sequel +tt0242653,"The Matrix Revolutions",2003,Movie;Sequel +---- + .actors8b.csv -[source] +[source, csv] ---- personId:ID,name,:LABEL keanu,"Keanu Reeves",Actor @@ -816,32 +911,64 @@ carrieanne,"Carrie-Anne Moss",Actor laurence,"Laurence Harvey",Actor ---- +.roles8b.csv +[source, csv] +---- +:START_ID,role,:END_ID,:TYPE +keanu,"Neo",tt0133093,ACTED_IN +keanu,"Neo",tt0234215,ACTED_IN +keanu,"Neo",tt0242653,ACTED_IN +laurence,"Morpheus",tt0133093,ACTED_IN +laurence,"Morpheus",tt0234215,ACTED_IN +laurence,"Morpheus",tt0242653,ACTED_IN +carrieanne,"Trinity",tt0133093,ACTED_IN +carrieanne,"Trinity",tt0234215,ACTED_IN +carrieanne,"Trinity",tt0242653,ACTED_IN +---- + [discrete] === Importing the data -The call to `neo4j-admin database import` would look like this: +You import the data from the CSV files into the database `foo` with a single command. +The database `foo` should not exist and it must be created afterward. +Paths to node data are defined with the `--nodes` option. +Paths to relationship data are defined with the `--relationships` option. + +include::partial$/full-import-drop-db.adoc[] -.shell -[source] +. In a separate terminal, run the `neo4j-admin database import full` command to import the data from the CSV files: ++ +[source, shell] ---- -bin/neo4j-admin database import full neo4j --database=neo4j --nodes=import/actors8b.csv +bin/neo4j-admin database import full foo \ +--nodes=import/movies8b.csv \ +--nodes=import/actors8b.csv \ +--relationships=import/roles8b.csv ---- - ++ Because there is a bad node in the input data, the import process will fail. -Let's see what happens if you append the `--skip-duplicate-nodes` flag: - -.shell -[source] +. Let's see what happens if you append the `--skip-duplicate-nodes` flag: ++ +[source, shell] ---- -bin/neo4j-admin database import full neo4j --skip-duplicate-nodes --nodes=import/actors8b.csv +bin/neo4j-admin database import full foo \ +--skip-duplicate-nodes \ +--nodes=import/movies8b.csv \ +--nodes=import/actors8b.csv \ +--relationships=import/roles8b.csv \ +--overwrite-destination ---- +include::partial$/full-import-query-db.adoc[] ++ The data files are successfully imported and the bad node is ignored. -An entry is written to the `import.report` file. - +An entry is written to the `report.json.log` file. +See xref:import.adoc#import-logs[Import progress reporting] for details. +For previous versions, see the `import.report` file. ++ .ignore bad nodes -[source] +[result, subs="attributes+,+macros"] ---- -ID 'laurence' is defined more than once in global ID space, at least at actors8b.csv:3 and actors8b.csv:5 +{"problem":"DuplicateNode","message":"Id defined multiple times\n'laurence' is defined more than once in group 'global id space'","source":null,"line":0,"node":{"id":"laurence","group":null}} ---- diff --git a/modules/ROOT/partials/full-import-drop-db.adoc b/modules/ROOT/partials/full-import-drop-db.adoc new file mode 100644 index 0000000000..14a215010f --- /dev/null +++ b/modules/ROOT/partials/full-import-drop-db.adoc @@ -0,0 +1,13 @@ +. In a terminal, connect to the `system` database using Cypher Shell or another Neo4j client: ++ +[source, shell] +---- +bin/cypher-shell -d system -u neo4j -p my-password +---- + +. Drop the database `foo` if it already exists: ++ +[source, cypher] +---- +DROP DATABASE foo IF EXISTS; +---- \ No newline at end of file diff --git a/modules/ROOT/partials/full-import-query-db.adoc b/modules/ROOT/partials/full-import-query-db.adoc new file mode 100644 index 0000000000..0b2807504a --- /dev/null +++ b/modules/ROOT/partials/full-import-query-db.adoc @@ -0,0 +1,23 @@ +. In your Cypher Shell terminal, create the database `foo`: ++ +[source, cypher] +---- +CREATE DATABASE foo; +---- + +. Switch to the `foo` database: ++ +[source, cypher] +---- +:use foo; +---- + +. Run a Cypher query to check that the data has been imported correctly: ++ +[source, cypher] +---- +MATCH (n) +RETURN count(n) as nodes; +---- ++ +This query returns `6` as there are 6 nodes in the graph (3 movies and 3 actors). \ No newline at end of file