Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multi-statement execution #722

Merged
merged 33 commits into from
Jul 2, 2018

Conversation

oskarhane
Copy link
Member

@oskarhane oskarhane commented Mar 19, 2018

Description

Neo4j Browser will separate all statements and execute them one-by-one and break on first error and present them in a single frame with expandable view to see information about the result, but not the result itself.

Requirements

  • Only Cypher queries will be executed in the multi statement context. Any client commands (those starting with :) will be ignored.
    • Possible exception is :param since they're related to cypher queries and can be seen as a natural part of a multi statement story
  • Execute commands in serial and break on first error.
  • It's NOT a transaction and nothing will be rolled back on error.
  • Cypher warnings / hints should work as before.

Information

Changes that made this possible:

  • produce error frame for unknown commands instead of red banner
  • upgrade of the error frame to have all error frames look the same
  • lot's of changes to cypher-codemirror which now exports a parse command

oskarhane-mbpt 2018-03-19 at 22 50 57

For Reviewers

Command to try (all of northwind guide):

LOAD CSV WITH HEADERS FROM "http://data.neo4j.com/northwind/products.csv" AS row
CREATE (n:Product)
SET n = row,
  n.unitPrice = toFloat(row.unitPrice),
  n.unitsInStock = toInteger(row.unitsInStock), n.unitsOnOrder = toInteger(row.unitsOnOrder),
  n.reorderLevel = toInteger(row.reorderLevel), n.discontinued = (row.discontinued <> "0");

LOAD CSV WITH HEADERS FROM "http://data.neo4j.com/northwind/categories.csv" AS row
CREATE (n:Category)
SET n = row;

LOAD CSV WITH HEADERS FROM "http://data.neo4j.com/northwind/suppliers.csv" AS row
CREATE (n:Supplier)
SET n = row;

CREATE INDEX ON :Product(productID);

CREATE INDEX ON :Category(categoryID);

CREATE INDEX ON :Supplier(supplierID);

LOAD CSV WITH HEADERS FROM "http://data.neo4j.com/northwind/customers.csv" AS row
CREATE (n:Customer)
SET n = row;

LOAD CSV WITH HEADERS FROM "http://data.neo4j.com/northwind/orders.csv" AS row
CREATE (n:Order)
SET n = row;

CREATE INDEX ON :Customer(customerID);

CREATE INDEX ON :Order(orderID);

MATCH (c:Customer),(o:Order)
WHERE c.customerID = o.customerID
CREATE (c)-[:PURCHASED]->(o);

LOAD CSV WITH HEADERS FROM "http://data.neo4j.com/northwind/order-details.csv" AS row
MATCH (p:Product), (o:Order)
WHERE p.productID = row.productID AND o.orderID = row.orderID
CREATE (o)-[details:ORDERS]->(p)
SET details = row,
  details.quantity = toInteger(row.quantity);

@oskarhane
Copy link
Member Author

Don't merge, will add more tests

@oskarhane oskarhane force-pushed the multi-statements branch 2 times, most recently from ecb8877 to df5d2c6 Compare March 20, 2018 09:49
@oskarhane
Copy link
Member Author

More tests added

@neo4j neo4j deleted a comment from vercel bot Jun 28, 2018
Put it on the epic level so all commands get extracted and handled as editor commands = support from everywhere as long as `executeCommand` is used.
- Get all statements from `parse()`
@pe4cey pe4cey merged commit e3db5e2 into neo4j:master Jul 2, 2018
@oskarhane oskarhane deleted the multi-statements branch October 23, 2018 14:47
myzero1 pushed a commit to myzero1/neo4j-browser that referenced this pull request May 17, 2019
Add support for multi-statement execution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants