此代码可以很好地加载,但是花了一段时间,所以我决定采用apoc周期性加载。我将CALL apoc.periodic.iterate('
添加到开头,并将',{batchSize:10000, iterateList:true, parallel:true})
添加到结尾。但是我遇到了一个错误问题。
// 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})
我遇到了错误:
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('"
^
答案 0 :(得分:1)
由于错误状态,apoc.periodic.iterate接受2个Cypher语句(加上配置选项)。您只提供1条陈述。阅读文档以获取更多详细信息。
但是,您应该知道LOAD CSV
通过USING PERIODIC COMMIT
支持transaction batching。因此,您可以尝试将apoc.periodic.iterate
放在USING PERIODIC COMMIT 10000
子句之前,而不是在LOAD CSV
中运行查询。
顺便说一下,文档的transaction batching部分也显示了一种使用apoc.periodic.iterate
的方法。