Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-17-2020 03:02 PM
For example:
// Create orders
LOAD CSV WITH HEADERS FROM 'file:///orders.csv' AS row
MERGE (order:Order {orderID: row.OrderID})
ON CREATE SET order.shipName = row.ShipName;
Can the 'order.shipName' be replaced with something like 'order.$shipName' where $shipname is a variable, which will be read from the csv file. The reason I want to do this is that, I want to create a function that can be reused for different data models. All the examples in the neo4j documentation use hard-coded statements like above to create the graph. In such a case, for a new data model, I have to write totally different scripts to build the graph. Ideally, I want to pass the csv headers as parameters to create the graph, so that the code can be reused.
Secondly, can even the 'order' (to be used as 'label') be parameterized in above code? Does APOC help achieve this purpose? This looks like a common requirement. Isn't it?
Thanks for help.
04-18-2020 01:38 AM
You can use APOC procedures to support dynamic labels
https://neo4j.com/docs/labs/apoc/current/graph-updates/data-creation/
04-18-2020 03:47 PM
Thanks. good to know
All the sessions of the conference are now available online