Skip to content

Commit 234d42e

Browse files
committed
Document update/change/delete in block format incremental import
1 parent d13459e commit 234d42e

File tree

1 file changed

+98
-5
lines changed

1 file changed

+98
-5
lines changed

modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc

Lines changed: 98 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -607,12 +607,15 @@ For more information, see <<import-tool-header-format>>.
607607
====
608608
* New relationships between existing or new nodes.
609609

610-
The incremental import command cannot be used to:
610+
Starting from 2025.01, the incremental import command can also be used for:
611611

612-
* Add new properties to existing nodes or relationships.
613-
* Update or delete properties in nodes or relationships.
614-
* Update or delete labels in nodes.
615-
* Delete existing nodes and relationships.
612+
* Adding new properties to existing nodes or relationships.
613+
* Updating or deleting properties in nodes or relationships.
614+
* Updating or deleting labels in nodes.
615+
* Deleting existing nodes and relationships.
616+
617+
This is supported only by `block` format.
618+
See <<#_applying_changes_to_data_via_csv_files>> for more information.
616619

617620
=== Parameters
618621

@@ -1423,6 +1426,96 @@ neo4j_home$ --nodes persons.csv --nodes games.csv --id-type string
14231426
The `id` property of the nodes in the `persons` group will be stored as `long` type, while the `id` property of the nodes in the `games` group will be stored as `string` type, as the global `id-type` is a string.
14241427
====
14251428

1429+
[role=label--new-2025.01.0 label--block-only]
1430+
== Applying changes to data via CSV files
1431+
1432+
You can use CSV files to update your data during incremental import.
1433+
1434+
This feature is especially useful when you want to update existing nodes, relationships, labels, or properties in large datasets.
1435+
To be able to use this feature, each entity in the dataset must be associated with a unique ID.
1436+
1437+
[NOTE]
1438+
====
1439+
This feature is supported only by `block` format.
1440+
====
1441+
1442+
=== Set an explicit action for each row
1443+
1444+
You can set an explicit action for each row in the CSV file by using the `:ACTION` keyword in the header file.
1445+
If no action is specified, the import tool works as in full import mode, creating new data.
1446+
1447+
The following actions are supported:
1448+
1449+
* `empty` = `CREATE` (default)
1450+
* `C`, `CREATE` - Creates a new entity.
1451+
* `U`, `UPDATE` - Updates an existing entity.
1452+
* `D`, `DELETE` - Deletes an existing entity.
1453+
Deleting a node also deletes its relationships (`DETACH DELETE`).
1454+
1455+
1456+
.Using actions in CSV files to update data
1457+
[source, cypher, role="nocopy"]
1458+
----
1459+
:ACTION,personId:ID,name,:LABEL
1460+
CREATE,1,"Keanu Reeves",Actor
1461+
UPDATE,2,"Laurence Fishburne",Actor
1462+
DELETE,4
1463+
----
1464+
1465+
=== Update existing labels
1466+
1467+
You can add or remove one or more labels from an existing node by prepending the clause `LABEL` in the header with a a `+` (default) or `-`:
1468+
1469+
* `:+LABEL` - Add one or more labels to an existing node.
1470+
* `:-LABEL` - Remove one or more labels (if they exist) from an existing node.
1471+
1472+
Multiple labels are separated by a semicolon.
1473+
1474+
For example, a file could have the following format:
1475+
1476+
[source, csv]
1477+
----
1478+
p0:ID,:+LABEL,:-LABEL,name,age
1479+
person1,Actor,Person,"Keanu Reeves",55
1480+
person2,Actor;Director,Person,"Laurence Fishburne",60
1481+
person3,Actor,Person,"Carrie-Anne Moss",53
1482+
----
1483+
1484+
In this case, all labels in the second column are added and all the labels in the third column are removed (if they exist).
1485+
The nodes are identified by their `p0` key.
1486+
1487+
=== Update existing properties
1488+
1489+
You can add or remove properties from an existing entity by prepending the clause `PROPERTY` in the header with a `+` or `-`:
1490+
1491+
* `:+PROPERTY` - Add one or more properties (if they exist) to an existing entity.
1492+
* `:-PROPERTY` - Remove one or more properties (if they exist) from an existing entity.
1493+
1494+
Multiple properties are separated by a semicolon.
1495+
1496+
For example, a file could have the following format:
1497+
1498+
.Update nodes' properties
1499+
[source, cypher, role="nocopy"]
1500+
----
1501+
p0:ID,:LABEL,:+PROPERTY,:-PROPERTY
1502+
person1,Actor,role,description
1503+
person1,Actor;Director,role,description
1504+
person1,Actor,role,description
1505+
----
1506+
1507+
In this case, all properties in the third column are added and all the properties in the fourth column are removed (if they exist).
1508+
The nodes are identified by their `p0` key.
1509+
1510+
.Update relationships' properties
1511+
[source, cypher, role="nocopy"]
1512+
----
1513+
:START_ID,:END_ID,:TYPE,:+PROPERTY,:-PROPERTY
1514+
1,2,ACTED_IN,role,description
1515+
----
1516+
1517+
In this case, all properties in the fourth column are added and all the properties in the fifth column are removed (if they exist).
1518+
The relationships are identified by their `:START_ID`, `:END_ID`, and `:TYPE` keys.
14261519

14271520
== Importing data that spans multiple lines
14281521

0 commit comments

Comments
 (0)