Neo4j Transaction

Neo4j Transaction

Certified

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.

yaml
type: io.kestra.plugin.neo4j.Transaction

Create a node and link it atomically

yaml
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

yaml
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
Min items1

Cypher 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.

Definitions

One statement of the statements list. All statements of a Transaction task run in the same managed transaction, in the order they are declared.

query*string

Cypher statement to run

Rendered with Flow variables before execution. Use $name placeholders and bind their values with parameters.

parametersobject

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).

DefaultWRITE
Possible Values
READWRITE

Session access mode

Routes units of work to read or write servers in a cluster. Ignored against a single server (default WRITE).

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.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset 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.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150

Bearer token

Base64-encoded bearer token. Cannot be combined with any other authentication mode.

DefaultPT30S

Connection timeout

Maximum time to establish a socket connection (default 30 seconds).

Custom authentication credentials

Credentials for custom authentication. Must be set together with customAuthScheme and customAuthPrincipal.

Custom authentication principal

Principal for custom authentication. Must be set together with customAuthScheme and customAuthCredentials.

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.

Neo4j database name

Target database for the session (e.g. neo4j). When empty, the server default database is used.

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.

Kerberos ticket

Base64-encoded Kerberos service ticket. Cannot be combined with any other authentication mode.

Default100

Maximum connection pool size

Maximum number of pooled connections towards a single database, or per cluster member with routing (default 100).

DefaultPT30S

Maximum 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 for basic auth

Must be used together with username.

Possible Values
SYSTEMCUSTOMALL

TLS 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.

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).

Neo4j endpoint URL

Bolt or HTTP(S) URI used to open the driver connection.

Username for basic auth

Must be used together with password.

Aggregated write counters

Sum of the Neo4j counters of every statement of the transaction.

Definitions
labelsAddedinteger

Labels added

labelsRemovedinteger

Labels removed

nodesCreatedinteger

Nodes created

nodesDeletedinteger

Nodes deleted

propertiesSetinteger

Properties set

relationshipsCreatedinteger

Relationships created

relationshipsDeletedinteger

Relationships deleted

Time until results were available (ms)

Total number of milliseconds the transaction took before the results of all statements were available.

The number of labels added to nodes by the transaction.

The number of labels removed from nodes by the transaction.

The number of nodes created by the transaction.

The number of nodes deleted by the transaction.

The number of properties set by the transaction.

The number of relationships created by the transaction.

The number of relationships deleted by the transaction.