Reputation: 2117
This code loads fine but was taking a while so I decided to go with the apoc periodic load. I added the CALL apoc.periodic.iterate('
to the beginning and ',{batchSize:10000, iterateList:true, parallel:true})
to the end. But am having issues with an error.
// URL ONLY
CALL apoc.periodic.iterate('
LOAD CSV WITH HEADERS FROM ("file:///sessions/4_hour_parsed_and_ready.csv") AS row
MERGE (a:Sender { name: row.From, domain: row.Sender_Sub_Fld})
MERGE (b:Link { name: row.Url_Sub_Fld, topLevelDomain: row.Url_Tld, htmlEncodedMessage: row.HTML_Encoded})
MERGE (c:Recipient { name: row.To})
WITH a,b,c,row
WHERE row.FileName = "false" AND NOT row.Url_Tld = "false"
CALL apoc.merge.relationship(a, row.Outcome, {}, {}, b) YIELD rel as rel1
CALL apoc.merge.relationship(b, row.Outcome2, {}, {}, c) YIELD rel as rel2
RETURN a,b,c
',{batchSize:10000, iterateList:true, parallel:true})
I am running into the error:
Neo.ClientError.Statement.SyntaxError: Procedure call does not provide the required number of arguments: got 2 expected 3.
Procedure apoc.periodic.iterate has signature: apoc.periodic.iterate(cypherIterate :: STRING?, cypherAction :: STRING?, config :: MAP?) :: batches :: INTEGER?, total :: INTEGER?, timeTaken :: INTEGER?, committedOperations :: INTEGER?, failedOperations :: INTEGER?, failedBatches :: INTEGER?, retries :: INTEGER?, errorMessages :: MAP?, batch :: MAP?, operations :: MAP?, wasTerminated :: BOOLEAN?, failedParams :: MAP?
meaning that it expects 3 arguments of type STRING?, STRING?, MAP?
Description: apoc.periodic.iterate('statement returning items', 'statement per item', {batchSize:1000,iterateList:true,parallel:false,params:{},concurrency:50,retries:0}) YIELD batches, total - run the second statement for each item returned by the first statement. Returns number of batches and total processed rows (line 2, column 1 (offset: 12))
"CALL apoc.periodic.iterate('"
^
Upvotes: 0
Views: 1779
Reputation: 67009
As the error states, apoc.periodic.iterate takes 2 Cypher statements (plus the config options). You are only supplying 1 statement. Read the documentation for more details.
However, you should be aware that LOAD CSV
supports transaction batching via USING PERIODIC COMMIT
. So, instead of running your query within apoc.periodic.iterate
, you can try prepending USING PERIODIC COMMIT 10000
to your LOAD CSV
clause.
By the way, the transaction batching section of the docs also shows one way to use apoc.periodic.iterate
as well.
Upvotes: 1