cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Is there a way to call multiple cypher/load csv commands file from a master cypher file?

Is there a way to call multiple load csv commands file from a master cypher file?

I have a placeholder cypher file which keeps getting modified by adding more script or making changes in the older script, I want to have a master cypher file in my CI/CD pipe line so that all the latest changes are automatically executed.

Thanks
Danny

1 REPLY 1

For example

I have following cypher in a chile-file and want to call all the statement given in this file from a master file.

CREATE CONSTRAINT Question_Id IF NOT EXISTS ON (q:Question) assert q.qId is unique;
CREATE CONSTRAINT Answer_Id IF NOT EXISTS ON (a:Answer) assert a.aId is unique;
CREATE CONSTRAINT Project_Id IF NOT EXISTS ON (p:Project) assert p.projectId is unique;
CREATE CONSTRAINT Process_Id IF NOT EXISTS ON (p:Process) assert p.processId is unique;
CREATE CONSTRAINT Step_Id IF NOT EXISTS ON (s:Step) assert s.stepId is unique;
CREATE CONSTRAINT Prerequisite_name IF NOT EXISTS ON (pre:Prerequisite) assert pre.name is unique;
//CREATE CONSTRAINT Solution_name_weight_imp ON (s:Solution) ASSERT (s.solutionName, s.weights,s.importance) IS NODE KEY
//CREATE CONSTRAINT Solution_name_weight_imp ON (s:Solution) ASSERT (s.solutionName, s.weights,s.importance) IS unique

match(s:Solution) detach delete s;

LOAD CSV WITH HEADERS FROM 'file:///Neo4jDMAnswers.csv' AS row
MERGE (a:Answer{aId:toInteger(row.aId),name:row.Description, RelationshipText:toUpper(row.RelationshipText)});

LOAD CSV WITH HEADERS FROM 'file:///Neo4jDMCharacteristics.csv' AS row
MERGE (c:Characteristics{cId:toInteger(row.cId),name:row.Description, RelationshipText:toUpper(row.RelationshipText)});