-
Notifications
You must be signed in to change notification settings - Fork 79
Add tabbed examples for multiple node IDs #2512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
NataliaIvakina
wants to merge
8
commits into
neo4j:dev
Choose a base branch
from
NataliaIvakina:dev-add-label
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2b7a92c
Add tabbed examples for multiple node IDs
NataliaIvakina 7e67dee
Fix syntax mistake
NataliaIvakina 62e4c48
Update import.adoc
NataliaIvakina 37596e2
Apply suggestions from code review
NataliaIvakina b08d0f8
Update modules/ROOT/pages/import.adoc
NataliaIvakina f412d23
Update modules/ROOT/pages/import.adoc
NataliaIvakina 0519f55
Update import.adoc
NataliaIvakina cfddffc
Update import.adoc
NataliaIvakina File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1464,39 +1464,64 @@ Now use the previously defined ID spaces when connecting the actors to movies. | |||||||||
== Using multiple node IDs | ||||||||||
|
||||||||||
A node header can contain multiple `ID` columns. | ||||||||||
The relationship data must then use a matching number of `START_ID` / `END_ID` columns as references to the composite value of those ID columns. | ||||||||||
|
||||||||||
Starting from 2025.07, the relationship data must then use a matching number of `START_ID` / `END_ID` columns as references to the composite value of those ID columns. | ||||||||||
This 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. | ||||||||||
|
||||||||||
[NOTE] | ||||||||||
[IMPORTANT] | ||||||||||
==== | ||||||||||
Incremental import doesn't support the use of multiple node identifiers. | ||||||||||
This functionality is only available with a full import. | ||||||||||
==== | ||||||||||
|
||||||||||
|
||||||||||
.Define multiple IDs as node properties | ||||||||||
==== | ||||||||||
You can define multiple `ID` columns in the node header. | ||||||||||
For example, you can define a node header with two `ID` columns. | ||||||||||
=== Define multiple IDs as node properties | ||||||||||
|
||||||||||
. Define multiple `ID` columns in the node header. | ||||||||||
+ | ||||||||||
.nodes_header.csv | ||||||||||
[source, csv] | ||||||||||
---- | ||||||||||
:ID,:ID,name | ||||||||||
---- | ||||||||||
|
||||||||||
+ | ||||||||||
.nodes.csv | ||||||||||
[source, csv] | ||||||||||
---- | ||||||||||
aa,11,John | ||||||||||
bb,22,Paul | ||||||||||
---- | ||||||||||
|
||||||||||
. Define the relationship between two established nodes. | ||||||||||
+ | ||||||||||
[.tabbed-example] | ||||||||||
===== | ||||||||||
[role=include-with-single-ID-column] | ||||||||||
====== | ||||||||||
|
||||||||||
Now use both IDs when defining the relationship: | ||||||||||
|
||||||||||
.relationships_header.csv | ||||||||||
[source, csv] | ||||||||||
---- | ||||||||||
:START_ID,:TYPE,:END_ID | ||||||||||
---- | ||||||||||
|
||||||||||
.relationships.csv | ||||||||||
[source, csv] | ||||||||||
---- | ||||||||||
aa11,WORKS_WITH,bb22 | ||||||||||
---- | ||||||||||
|
||||||||||
====== | ||||||||||
[role=include-with-multiple-ID-columns label--new-2025.07] | ||||||||||
====== | ||||||||||
|
||||||||||
Starting from 2025.07, you have to use a matching number of `START_ID` / `END_ID` columns when defining the relationship: | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
.relationships_header.csv | ||||||||||
[source, csv] | ||||||||||
---- | ||||||||||
|
@@ -1508,28 +1533,51 @@ Now use both IDs when defining the relationship: | |||||||||
---- | ||||||||||
aa,11,WORKS_WITH,bb,22 | ||||||||||
---- | ||||||||||
==== | ||||||||||
====== | ||||||||||
===== | ||||||||||
|
||||||||||
[[multiple-IDs-Id-spaces]] | ||||||||||
.Define multiple IDs stored in ID spaces | ||||||||||
==== | ||||||||||
|
||||||||||
Define a `MyGroup` ID space in the _nodes_header.csv_ file. | ||||||||||
=== Define multiple IDs stored in ID spaces | ||||||||||
|
||||||||||
. Define a `MyGroup` ID space in the _nodes_header.csv_ file. | ||||||||||
+ | ||||||||||
.nodes_header.csv | ||||||||||
[source, csv] | ||||||||||
NataliaIvakina marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
---- | ||||||||||
personId:ID(MyGroup),memberId:ID(MyGroup),name | ||||||||||
---- | ||||||||||
|
||||||||||
+ | ||||||||||
.nodes.csv | ||||||||||
[source, csv] | ||||||||||
NataliaIvakina marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
---- | ||||||||||
aa,11,John | ||||||||||
bb,22,Paul | ||||||||||
---- | ||||||||||
|
||||||||||
Now use the defined ID space when connecting John with Paul, and use both IDs in the relationship. | ||||||||||
. Now use the defined ID space when connecting John with Paul, and use both IDs in the relationship. | ||||||||||
+ | ||||||||||
[.tabbed-example] | ||||||||||
===== | ||||||||||
[role=include-with-single-ID-column] | ||||||||||
====== | ||||||||||
|
||||||||||
.relationships_header.csv | ||||||||||
[source, csv] | ||||||||||
---- | ||||||||||
:START_ID(MyGroup),:TYPE,:END_ID(MyGroup) | ||||||||||
---- | ||||||||||
|
||||||||||
.relationships.csv | ||||||||||
[source, csv] | ||||||||||
---- | ||||||||||
aa11,WORKS_WITH,bb22 | ||||||||||
---- | ||||||||||
|
||||||||||
====== | ||||||||||
[role=include-with-multiple-ID-columns label--new-2025.07] | ||||||||||
====== | ||||||||||
|
||||||||||
Starting from 2025.07, you have to use a matching number of `START_ID` / `END_ID` columns when defining the relationship: | ||||||||||
|
||||||||||
.relationships_header.csv | ||||||||||
[source, csv] | ||||||||||
|
@@ -1542,7 +1590,9 @@ Now use the defined ID space when connecting John with Paul, and use both IDs in | |||||||||
---- | ||||||||||
aa,11,WORKS_WITH,bb,22 | ||||||||||
---- | ||||||||||
==== | ||||||||||
====== | ||||||||||
===== | ||||||||||
|
||||||||||
|
||||||||||
[[import-tool-id-types-header]] | ||||||||||
== Storing a different value type for IDs in a group | ||||||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this true? If I read the comments for the https://github.com/neo-technology/neo4j/pull/31617 correctly, it is still allowed to use a single :START_ID/:END_ID to refer to a composite ID.
But it is not allowed to mix how to refer to composite IDs. Either all references must use a single :START_ID/:END_ID columns, or a matching amount.
I think this should be reflected on this page too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you're right that it is still allowed to use a single :START_ID/:END_ID to refer to a composite ID, we don't want to document that behavior necessarily. It was never really meant to work that way and it is only still possible to not break potential usages of this behavior.
We want to encourage using a matching number of
START_ID
/END_ID
columns and the other possibility was not meant to exist and should therefor IMO not be documented.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good. I understand your intention, but the trick here is that the Operations manual covers also earlier versions of Neo4j (2025.01-2025.06), in which you cannot use matching number of
START_ID
/END_ID
columns. If a user is on 2025.02 and tries to follow the current example, he will get an error. Am I right?Therefore we have to say that this functionality is available starting from 2025.07 and provide tabbed examples for earlier versions and for 2025.07.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I guess that makes sense.