Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-03-2019 03:14 AM
Could I use apoc.convert.fromJsonList inside apoc.periodic.iterate?
Where are the mistakes in this query?
CALL apoc.periodic.iterate('
apoc.convert.fromJsonList('[1,2,3]') as v RETURN v'
,'
MERGE (person:Person {name:"Bob"})
',
{ batchSize: 10000, iterateList: true, parallel:true });
Solved! Go to Solution.
10-04-2019 06:33 AM
I think you might be after something like this:
CALL apoc.periodic.iterate(
'RETURN apoc.convert.fromJsonList("[1,2,3]") AS v',
'UNWIND v as item MERGE (person:Person {name:"Bob-" + item})',
{ batchSize: 10000, iterateList: true, parallel:true })
10-04-2019 06:33 AM
I think you might be after something like this:
CALL apoc.periodic.iterate(
'RETURN apoc.convert.fromJsonList("[1,2,3]") AS v',
'UNWIND v as item MERGE (person:Person {name:"Bob-" + item})',
{ batchSize: 10000, iterateList: true, parallel:true })
10-04-2019 06:56 AM
Thank for your response!
But If I want process the JSON. What kind of quotes I need to use?
CALL apoc.periodic.iterate(
'RETURN apoc.convert.fromJsonList("[
{
"id": "01",
"name": "Bob",
"home": {
"main": ["first"],
"alternate": []
}
},
{
"id": "02",
"name": "Rome",
"home": {
"main": ["second"],
"alternate": []
}
}]") AS v',
'UNWIND v as item MERGE (person:Person {name:"Bob-" + item})',
{ batchSize: 10000, iterateList: true, parallel:true })
I see the error:
Neo.ClientError.Procedure.ProcedureCallFailed: Failed to invoke procedure apoc.periodic.iterate
: Caused by: org.neo4j.cypher.internal.v3_5.util.SyntaxException: Invalid input 'd': expected 'n/N' or 's/S' (line 3, column 7 (offset: 69))
All the sessions of the conference are now available online