Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
12-28-2021 12:30 PM
I have a cypher script file “test.cypher”:
CALL apoc.load.csv('rawCount.tsv', {header:true, sep:'\t'})
YIELD map, list
CALL {
WITH map, list
MERGE (g:Gene{symbol: list[0]})
WITH *
UNWIND keys(map)[1..] AS key
WITH *, toInteger(map[key]) AS value
MATCH (c:Cell{name: key})
WHERE 0 < value
MERGE (g)-[x:x{value: value}]->(c)
} IN TRANSACTIONS OF 1000 ROWS;
Then I am using “apoc.cypher.runFile” to run it:
CALL apoc.cypher.runFile("test.cypher");
But no error and no result, immediately return:
+--------------+
| row | result |
+--------------+
+--------------+
0 rows
ready to start consuming query after 5 ms, results consumed after another 1093 ms
If run the cypher in the cypher script directly, it works well. But looks like it is ignored when run it by “apoc.cypher.runFile”.
Something wrong? Any suggestions, thank you.
01-04-2022 07:50 AM
It seems a bug with IN TRANSACTIONS OF
statement introduced in 4.4 version.
As a matter of fact, substituting IN TRANSACTIONS OF 1000 ROWS
with a RETURN *
works.
I could suggest you to open a GitHub issue for this one.
Anyway, as a workaround, you could use the apoc.periodic.iterate
instead of IN TRANSACTION
statement, that is:
call apoc.periodic.iterate(
"CALL apoc.load.csv('test-tab.csv', {header:true, sep:'\t'}) YIELD map, list RETURN map, list",
"WITH map, list MERGE (g:Gene{symbol: list[0]})
WITH *
UNWIND keys(map)[1..] AS key
WITH *, toInteger(map[key]) AS value
MATCH (c:Cell{name: key})
WHERE 0 < value
MERGE (g)-[x:x{value: value}]->(c)", {batchSize:10000})
01-04-2022 11:15 AM
Thank you so much for your detailed reply.
I submitted a GitHub issue following your suggestion.
All the sessions of the conference are now available online