cancel
Showing results for 
Search instead for 
Did you mean: 

Apoc Export to cvs fails when putting a working query in the export format (APOC.path in Apoc.Export

Koen_Algoet
Node Clone

I have a working Query which I'm want to export to CVS.  

But when fitting the query in the APOC.EXPORT function it fails.

Are there limits in what we can pass as query to APOC.Export?

Working query;

Koen_Algoet_0-1661757377104.png

MATCH (n:Tank)
CALL apoc.path.expandConfig(n, { relationshipFilter:"CanExportToBarge>",minLevel:7, maxLevel:12,labelFilter:"/Connection"}) 
YIELD path
with ([in nodes(path) | n.Name] ) as PathNodes, 
[["B11_1","B11_2"],
["B12_1","B12_2"],
["B13_1","B13_2"]] as dependencies
where all(in dependencies where ((not x[0] in PathNodes) OR (x[1] in PathNodes)))
return  PathNodes as ListofNodesInPath

ps: reduced the depency node list a bit for readability reason

Failing export

CALL apoc.export.csv.query

( " 
MATCH (n:Tank )
CALL apoc.path.expandConfig(n, {
  relationshipFilter:"CanExportToBarge>", minLevel:1, maxLevel:12, labelFilter:"/Connection"
})
YIELD path
WITH ([IN nodes(path) | n.Name] ) AS PathNodes,
[["B11_1", "B11_2"],
["B12_1", "B12_2"] AS dependencies
WHERE all(IN dependencies
WHERE (( NOT x[0] IN PathNodes) OR (x[1] IN PathNodes)))
RETURN PathNodes 
"
, "AllPathsFromTankToBargeConnections.csv", {
}
)
YIELD rows
RETURN rows

 

 

 

1 ACCEPTED SOLUTION

glilienfield
Ninja
Ninja

Your export cypher query is wrapped in double quotes, while the query itself has double quotes.  It must be having trouble parsing the cypher. Try wrapping the export query in single quotes, 

View solution in original post

1 REPLY 1

glilienfield
Ninja
Ninja

Your export cypher query is wrapped in double quotes, while the query itself has double quotes.  It must be having trouble parsing the cypher. Try wrapping the export query in single quotes, 

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.