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

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 ([n in nodes(path) | n.Name] ) as PathNodes,

[["B11_1","B11_2"],

["B12_1","B12_2"],

["B13_1","B13_2"]] as dependencies

where all(x 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 ([n IN nodes(path) | n.Name] ) AS PathNodes,

[["B11_1", "B11_2"],

["B12_1", "B12_2"] ] AS dependencies

WHERE all(x IN dependencies

WHERE (( NOT x[0] IN PathNodes) OR (x[1] IN PathNodes)))

RETURN PathNodes

"

, "AllPathsFromTankToBargeConnections.csv", {

}

)

YIELD rows

RETURN rows

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,