0

I have a LOAD_CSV cypher script that creates and sets properties for nodes and edges.

I want to add a parameter at run time (i.e. when I do cat mycypher.cql | cypher-shell -u xxxx -p xxx) so that a key property gets set on nodes -- like so:

LOAD CSV WITH HEADERS FROM $MY_CSV AS row
MERGE (a:abcLabel {abcId: toInteger(row.abc_id), extraProp: $EXTRA_PROPERTY})
ON CREATE SET
    abc.name = row.abc_name
MERGE (b:bcdLabel {bcdId: toInteger(row.bcd_id), extraProp: $EXTRA_PROPERTY})
ON CREATE SET
    etc ....

Now, know that I can't use shell-like params, but is there a way to set $EXTRA_PROPERTY and $MY_FILE so that I can rerun the cql against a separate data set and ensure that a subsequent MATCH (:abcProperty {extraLabel: "xyz"}) will return nodes that were given the "xyz" property?

In principle this would be completely automated and templated so I will never do a manual load.

TIA

fiacre
  • 1,150
  • 2
  • 9
  • 26

1 Answers1

1

Upcoming version 1.2 of cypher-shell will support the command line option --param, which would allow you to specify Cypher parameters.

Here is the merged pull request.

cybersam
  • 63,203
  • 6
  • 53
  • 76