How to create dynamic relations from csv with apoc?

Unless the CALL is the only thing in the query, you need to explicitly YIELD variables from the call (using call apoc.help('create.rel') shows us this procedure yields arel` variable), and as in the message you can't end the query with a CALL, it needs to be a writing clause or a return. If you need the equivalent of a no-op then you can remove a non-existent property from a node or relationship:

LOAD CSV WITH HEADERS FROM "file:///relations.csv" AS row
MATCH (f:Node), (s:Node)
WHERE f.Name = row.FromNode
AND s.Name = row.ToNode
CALL apoc.create.relationship(f, row.RelationType,{}, s) YIELD rel
REMOVE rel.noOp
3 Likes