Skip to main content

Neo4j Nodestream Plugin for Nodestream

This plugin provides a Nodestream interface to Neo4j.

Installation

pip install nodestream-plugin-neo4j

Usage

# nodestream.yaml
targets:
  neo4j:
    database: neo4j
    uri: bolt://localhost:7687
    username: neo4j
    password: neo4j
    database_name: neo4j # optional; name of the database to use.
    use_enterprise_features: false # optional; use enterprise features (e.g. node key constraints)

Extractor

The Neo4jExtractor class represents an extractor that reads records from a Neo4j database. It takes a single Cypher query as input and yields the records read from the database. The extractor will automatically paginate through the database until it reaches the end. Therefore, the query needs to include a SKIP and LIMIT clause. For example:

- implementation: nodestream_plugin_neo4j.extractor:Neo4jExtractor
  arguments:
    query: MATCH (p:Person) WHERE p.name = $name RETURN p.name SKIP $offset LIMIT $limit
    uri: bolt://localhost:7687
    username: neo4j
    password: neo4j
    database_name: my_database # Optional; defaults to neo4j
    limit: 100000 # Optional; defaults to 100
    parameters:
      # Optional; defaults to {}
      # Any parameters to be passed to the query
      # For example, if you want to pass a parameter called "name" with the value "John Doe", you would do this:
      name: John Doe

The extractor will automatically add the SKIP and LIMIT clauses to the query. The extractor will also automatically add the offset and limit parameters to the query. The extractor will start with offset set to 0 and limit set to 100 (unless overridden by setting limit) The extractor will continue to paginate through the database until the query returns no results.

Copy Command

The nodestream copy command copies nodes and relationships from one Neo4j target to another. The Neo4j plugin exposes the following --retriever-option parameters to tune throughput.

Retriever options (--retriever-option key=value)

Option Type Default Description
limit int 100 Page size for each paginated Cypher query (SKIP $offset LIMIT $limit). Larger values mean fewer round-trips.
shard_size int — When set, each relationship type is split into shards of this size and fetched concurrently. Requires a key field or falls back to elementId.
sample_ratio int — Only copy records where toInteger(split(elementId(r), ':')[-1]) % sample_ratio = 0. A deterministic, reproducible subset. 1 is treated as disabled.
latest_hours int — Only copy records where last_ingested_at >= now() - latest_hours. Useful for incremental copies.
relationships_only bool false Skip node fetching entirely; only copy relationships.

Connector options (--connector-option key=value)

Option Type Default Description
chunk_size int target default Number of records per Cypher write batch inside each flush lane.
execute_chunks_in_parallel bool false Run write chunks concurrently within each flush lane.
retries_per_chunk int 0 Number of times to retry a failed write chunk before raising.

Best-known configuration (relationships, 24 h incremental)

Benchmark result: ~27 min, ~776 relationships/s peak for a production graph with ~1.27 M relationships (2026-06-24, sample_ratio=100).

nodestream copy \
  --from <source> \
  --to <destination> \
  --all \
  --retriever-option relationships_only=true \
  --retriever-option latest_hours=24 \
  --retriever-option shard_size=10000 \
  --concurrency-limit 20 \
  --flush-concurrency 8 \
  --batch-size 100000 \
  --step-outbox-size 2000000 \
  --reporting-frequency 30 \
  --connector-option execute_chunks_in_parallel=true \
  --connector-option chunk_size=10000 \
  --connector-option retries_per_chunk=5 \
  --metrics-interval-in-seconds 30 \
  --json

Why these values:

  • shard_size=10000 — splits large relationship types into independent coroutines, filling all concurrency slots.
  • concurrency-limit=20 — higher values (e.g. 30–40) cause SessionExpired/network errors on the destination; 20 gives 0–50 errors vs. 200+ at 30.
  • flush-concurrency=8 — 8 parallel write lanes; saturates destination write throughput without overloading connections.
  • batch-size=100000 — larger batches amortise per-batch overhead; peak throughput higher than 50K batches.
  • step-outbox-size=2000000 — large buffer so the extractor is never blocked waiting for the writer to drain.
  • relationships_only=true + latest_hours=24 — incremental mode; nodes are stable, only new/changed relationships need copying.

Concepts

Migrations

The plugin supports migrations. Migrations are used to create indexes and constraints on the database.

As part of the migration process, the plugin will create __NodestreamMigration__ nodes in the database. This node will have a name property that is set to the name of the migration.

Additionally, the plugin will create a __NodestreamMigrationLock__ node in the database. This node will be exit when the migration process is running and will be deleted when the migration process is complete. This is used to prevent multiple migration processes from running at the same time.

Metadata

Release files for nodestream-plugin-neo4j 0.16.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nodestream-plugin-neo4j 0.16.0
File Size Uploaded Provenance
nodestream_plugin_neo4j-0.16.0.tar.gz 23.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nodestream-plugin-neo4j 0.16.0
File Interpreter ABI Platform
nodestream_plugin_neo4j-0.16.0-py3-none-any.whl Python 3 none any Details

Total release size: 50.1 kB

Release files / nodestream_plugin_neo4j-0.16.0.tar.gz

Download URL nodestream_plugin_neo4j-0.16.0.tar.gz
Size 23.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d32495f0ed23086e0c865766bfe7fa300c9515d70420d453b6d7db4f6059eb3e
BLAKE2b-256 checksum
How to use checksums
f4d43cde2c8fb383bf253ed17ac4cce51cf1a22097d9d9194a09b7f64fba46ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 24, 2026.

Transparency log

Release files / nodestream_plugin_neo4j-0.16.0-py3-none-any.whl

Download URL nodestream_plugin_neo4j-0.16.0-py3-none-any.whl
Size 26.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a51a5213bc1797d8623bf69744f38615ff0c72bc5b39416157101d38db0cb147
BLAKE2b-256 checksum
How to use checksums
72d348297e329b353e55415588fe22ef58a62c3d017255b2b613e6649b7bd986
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 24, 2026.

Transparency log

Security for nodestream-plugin-neo4j 0.16.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nodestream_plugin_neo4j-0.16.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.16.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page