
Neo4j Transaction
CertifiedRun multiple Cypher statements in one transaction
Neo4j Transaction
Run multiple Cypher statements in one transaction
Executes all statements inside a single managed write transaction, in order. A failure rolls the whole transaction back, and the driver retries transient failures (deadlocks, leader switches) until maxRetryTime is exhausted. A retry can replay an ambiguous commit, so keep statements idempotent (prefer MERGE over CREATE). Returns the aggregated Neo4j counters of the transaction.
type: io.kestra.plugin.neo4j.TransactionExamples
Create a node and link it atomically
id: neo4j_transaction
namespace: company.team
inputs:
- id: id
type: STRING
- id: name
type: STRING
tasks:
- id: tx
type: io.kestra.plugin.neo4j.Transaction
url: "{{ secret('NEO4J_URL') }}"
username: "{{ secret('NEO4J_USER') }}"
password: "{{ secret('NEO4J_PASSWORD') }}"
statements:
- query: "MERGE (p:Person {id: $id}) SET p.name = $name"
parameters:
id: "{{ inputs.id }}"
name: "{{ inputs.name }}"
- query: "MERGE (:Team {name: 'core'})"
- query: |
MATCH (p:Person {id: $id}), (t:Team {name: 'core'})
MERGE (p)-[:MEMBER_OF]->(t)
parameters:
id: "{{ inputs.id }}"
Log the write summary of a transaction
id: neo4j_transaction_summary
namespace: company.team
tasks:
- id: tx
type: io.kestra.plugin.neo4j.Transaction
url: "{{ secret('NEO4J_URL') }}"
username: "{{ secret('NEO4J_USER') }}"
password: "{{ secret('NEO4J_PASSWORD') }}"
statements:
- query: "MATCH (n:Temp) DETACH DELETE n"
- query: |
MERGE (r:CleanupRun {id: $id})
SET r.finishedAt = datetime()
parameters:
id: "{{ execution.id }}"
- id: log
type: io.kestra.plugin.core.log.Log
message: "Deleted {{ outputs.tx.counters.nodesDeleted }} nodes"
Properties
statements *array
1Cypher statements to run atomically
Rendered with Flow variables, then executed in declaration order inside one managed write transaction. A failure in any statement rolls back all of them. The list itself is not rendered as one expression, so statements: "{{ outputs.x.list }}" does not resolve. Template values inside each query and parameters do.
A Cypher statement executed inside the transaction
One statement of the statements list. All statements of a Transaction task run in the same managed transaction, in the order they are declared.
Cypher statement to run
Rendered with Flow variables before execution. Use $name placeholders and bind their values with parameters.
Query parameters
Values bound to the $name placeholders of query, for example id: "{{ inputs.id }}". A value produced by a Pebble expression is bound as a string; cast it in Cypher, for example with toInteger($id).
accessMode string
WRITEREADWRITESession access mode
Routes units of work to read or write servers in a cluster. Ignored against a single server (default WRITE).
assets
Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.
io.kestra.core.models.assets.AssetsDeclaration
IGNOREFAILWARNAsset failure behavior
Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.
Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.
The assets consumed as inputs.
io.kestra.core.models.assets.AssetIdentifier
1The assets produced as outputs.
io.kestra.plugin.ee.assets.Dataset
1150{}1150io.kestra.plugin.ee.assets.File
1150{}1150io.kestra.plugin.ee.assets.Table
1150{}1150io.kestra.plugin.ee.assets.VM
1150{}1150io.kestra.core.models.assets.External
1150{}1150io.kestra.core.models.assets.Custom
11501Custom asset type
{}1150bearerToken string
Bearer token
Base64-encoded bearer token. Cannot be combined with any other authentication mode.
connectionTimeout string
PT30SConnection timeout
Maximum time to establish a socket connection (default 30 seconds).
customAuthCredentials string
Custom authentication credentials
Credentials for custom authentication. Must be set together with customAuthScheme and customAuthPrincipal.
customAuthPrincipal string
Custom authentication principal
Principal for custom authentication. Must be set together with customAuthScheme and customAuthCredentials.
customAuthScheme string
Custom authentication scheme
Scheme name for custom authentication. Must be set together with customAuthPrincipal and customAuthCredentials, and cannot be combined with any other authentication mode.
database string
Neo4j database name
Target database for the session (e.g. neo4j). When empty, the server default database is used.
encryption booleanstring
Enable TLS encryption
When true, encrypted traffic is forced with withEncryption(); when false, unencrypted traffic is forced with withoutEncryption(). When unset, the driver default applies so the connection URI scheme keeps working (bolt+s, bolt+ssc, neo4j+s, neo4j+ssc stay encrypted, plain bolt/neo4j stay unencrypted), except that supplying trustStrategy or trustedCertificate with a plain bolt:// or neo4j:// URL enables encryption automatically since trust settings are meaningless over plaintext.
kerberosTicket string
Kerberos ticket
Base64-encoded Kerberos service ticket. Cannot be combined with any other authentication mode.
maxConnectionPoolSize integerstring
100Maximum connection pool size
Maximum number of pooled connections towards a single database, or per cluster member with routing (default 100).
maxRetryTime string
PT30SMaximum retry time
ISO-8601 duration (default PT30S, maximum PT10M) during which the driver retries the transaction on transient failures such as deadlocks or leader switches. Must be between PT0S and PT10M inclusive.
password string
Password for basic auth
Must be used together with username.
trustStrategy string
SYSTEMCUSTOMALLTLS trust strategy
SYSTEM trusts system CA certificates (default), CUSTOM trusts the CA given in trustedCertificate, ALL trusts every certificate blindly and must only be used for development or tests. When unset and trustedCertificate is supplied, CUSTOM is inferred; otherwise SYSTEM applies.
trustedCertificate string
Trusted CA certificate
PEM-encoded CA certificate used with the CUSTOM trust strategy. Accepts either the PEM content itself (e.g. "{{ secret('NEO4J_CA_PEM') }}") or a Kestra internal storage URI (e.g. kestra://.../ca.crt).
url string
Neo4j endpoint URL
Bolt or HTTP(S) URI used to open the driver connection.
username string
Username for basic auth
Must be used together with password.
Outputs
counters
Aggregated write counters
Sum of the Neo4j counters of every statement of the transaction.
io.kestra.plugin.neo4j.Transaction-Counters
Labels added
Labels removed
Nodes created
Nodes deleted
Properties set
Relationships created
Relationships deleted
resultAvailableAfter integer
Time until results were available (ms)
Total number of milliseconds the transaction took before the results of all statements were available.
Metrics
labels.added counter
The number of labels added to nodes by the transaction.
labels.removed counter
The number of labels removed from nodes by the transaction.
nodes.created counter
The number of nodes created by the transaction.
nodes.deleted counter
The number of nodes deleted by the transaction.
properties.set counter
The number of properties set by the transaction.
relationships.created counter
The number of relationships created by the transaction.
relationships.deleted counter
The number of relationships deleted by the transaction.