Hi -
I am trying to find a way to run a multi-statement Cypher Query. These statements are separated from each other using semicolon(;), and i would like to execute them as single Cypher statement(in one go) in my application using Python Bolt drivers.
I have explored both Neo4j Standard Driver as well as Py2neo and understood that we can execute these statements one by one but i want to execute them in one go since executing them one by one will lead to performance issue fo the application. I explored extensively explored for the multi-statement Cypher aspect but couldn't find any concrete documentation material for this use-case using any of these 2 python drivers.
Here is the sample Cypher query containing 3 LOAD CSV statements that refer to Northwind database(Nodes: Customer, Order, and Relationship: Customers)
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM 'file:///customer.csv' AS row FIELDTERMINATOR ','
MERGE (n:Customer
{id
: toInt(row.id)})
SET n.id = toInt(row.id),n.Address = toString(row.Address),n.Company = toString(row.Company),n.Job = toString(row.Job);
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM 'file:///order.csv' AS row FIELDTERMINATOR ','
MERGE (n:Order
{id
: toInt(row.id)})
SET n.id = toInt(row.id),n.shipcity = toString(row.shipcity),n.orderdate = toString(row.orderdate),n.shipaddress = toString(row.shipaddress);
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM 'file:///relationship_customers.csv' AS line FIELDTERMINATOR ','
MATCH (a:Order
{id
: toInt(line[0])})
MATCH (b:Customer
{id
: toInt(line[1])})
MERGE (a)-[r:CUSTOMERS
]->(b);
Can you please share any pointers in this regard.