Graph script
Description
The Graph script action (previously Neo4j Cypher script) executes statements on a graph database in a workflow: Cypher statements, or Gremlin traversals on Gremlin servers.
As with all actions, the goal is not to retrieve data but to execute various statements like creating or dropping indexes, calling APOC procedures, add or delete some static data and so on.
The result of this action is a true or false exit code that determines if a success or failure hop to the next action in the workflow is chosen.
Important
To allow you to enter semi-colons (;) in commands, strings and so on we require you to separate commands with a semi-colon on a new line
Transactions
On a database with transactions the script runs in one transaction: when a statement fails, none of the statements are kept.
On Neo4j, a statement with CALL { … } IN TRANSACTIONS (or USING PERIODIC COMMIT on Neo4j 4) runs on its own in an auto-commit transaction, and the statements before and after it run in a transaction each.
The script then no longer runs in a single transaction: when a statement fails, the statements before it stay committed.
On Memgraph every statement runs on its own in an auto-commit transaction.
Configuration options
| Option | Description |
|---|---|
Connection name |
The name of the connection on which you want to execute the cypher statements. |
Script |
The script with cypher commands separated by a semi-colon (;) on a new line. For examples see below. |
Replace variables |
Check this option if you want to replace variables in the format |
Example
CREATE INDEX idx_company_id on :Company(id)
;
CREATE INDEX idx_company_id on :Company(id)
;