Skip to content

Data Import/Export Guide ​

Neo4j compatible data migration and backup


Overview ​

This guide covers importing Neo4j data through supported drivers and exporting NornicDB data. Neo4j store files are not interchangeable with NornicDB storage; use the transfer methods below and validate property types and queries against the selected release.


Importing from Neo4j ​

Using Neo4j Driver ​

python
from neo4j import GraphDatabase

# Connect to NornicDB (same as Neo4j)
driver = GraphDatabase.driver(
    "bolt://localhost:7687",
    auth=("admin", "admin")
)

# Run Cypher queries - identical syntax
with driver.session() as session:
    session.run("""
        CREATE (n:Person {name: 'Alice', age: 30})
        CREATE (m:Person {name: 'Bob', age: 25})
        CREATE (n)-[:KNOWS {since: 2020}]->(m)
    """)

Bulk Import via Cypher ​

cypher
-- Create multiple nodes
UNWIND $nodes AS nodeData
CREATE (n:Person)
SET n = nodeData

-- Create relationships
UNWIND $relationships AS relData
MATCH (a:Person {id: relData.from})
MATCH (b:Person {id: relData.to})
CREATE (a)-[:KNOWS {since: relData.since}]->(b)

JSON Import ​

bash
# Import nodes from JSON
curl -X POST http://localhost:7474/db/nornic/tx/commit \
  -H "Content-Type: application/json" \
  -d '{
    "statements": [{
      "statement": "UNWIND $nodes AS n CREATE (p:Person) SET p = n",
      "parameters": {
        "nodes": [
          {"name": "Alice", "age": 30},
          {"name": "Bob", "age": 25}
        ]
      }
    }]
  }'

Exporting Data ​

Export via Cypher ​

cypher
-- Export all nodes as JSON
MATCH (n)
RETURN labels(n) AS labels, properties(n) AS properties

-- Export with relationships
MATCH (n)-[r]->(m)
RETURN
  labels(n) AS fromLabels,
  properties(n) AS fromProps,
  type(r) AS relType,
  properties(r) AS relProps,
  labels(m) AS toLabels,
  properties(m) AS toProps

Export via HTTP API ​

bash
# Export query results
curl -X POST http://localhost:7474/db/nornic/tx/commit \
  -H "Content-Type: application/json" \
  -d '{
    "statements": [{
      "statement": "MATCH (n:Person) RETURN n"
    }]
  }' | jq '.results[0].data'

Neo4j Compatibility ​

Supported Features ​

FeatureStatusNotes
Cypher QueriesFullAll standard Cypher
Bolt ProtocolFullv4.4 compatible
HTTP APIFullNeo4j REST API
TransactionsFullACID compliant
IndexesFullB-tree and vector
ConstraintsFullUnique, exists

Driver Compatibility ​

All official Neo4j drivers work with NornicDB:

  • Python: neo4j package
  • JavaScript: neo4j-driver
  • Java: Neo4j Java Driver
  • Go: neo4j-go-driver
  • .NET: Neo4j.Driver

Migration Steps ​

From Neo4j to NornicDB ​

  1. Export from Neo4j:

Export Neo4j-compatible CSV files from Neo4j using the tooling you already use for offline import packages.

  1. Start NornicDB:

    bash
    docker run -d -p 7474:7474 -p 7687:7687 nornicdb
  2. Import to NornicDB:

    bash
    nornicdb-admin database import full mydb \
     --from-path=./neo4j-export \
     --data-dir=./data

If the folder includes schema.nornic.json or schema.cypher, nornicdb-admin will apply it automatically (preferring schema.nornic.json) unless you override --schema.

See the admin tool guide for CSV header examples, --from-path, and recovery notes.

From NornicDB to Neo4j ​

Use the offline admin export tool to create a Neo4j-compatible package:

bash
nornicdb-admin database export neo4j-csv mydb \
  --to-path=./neo4j-export \
  --data-dir=./data

This writes:

  • nodes.csv
  • relationships.csv when the database has relationships
  • schema.cypher when the database has exportable constraints or indexes

That package is designed to be re-imported with nornicdb-admin database import full --from-path=... and to stay close to Neo4j's offline CSV conventions.


Backup & Restore ​

Creating Backups ​

bash
# Trigger a snapshot via the authenticated admin HTTP endpoint
curl -X POST http://localhost:7474/admin/backup \
  -H "Authorization: Bearer $ADMIN_TOKEN"

For volume-level backups (raw tar of /data) see the Backup & Restore operations guide.


GDPR Compliance ​

Data Export (Right to Access) ​

bash
curl -X POST http://localhost:7474/gdpr/export \
  -H "Content-Type: application/json" \
  -d '{"userId": "user123"}'

Data Deletion (Right to Erasure) ​

bash
curl -X POST http://localhost:7474/gdpr/delete \
  -H "Content-Type: application/json" \
  -d '{"userId": "user123"}'


Ready to migrate? → Getting Started

Analytics privacy