neo4j-spark-skill

Read and write Neo4j graph data from Apache Spark and Databricks using the Neo4j Spark Connector.

Updated Jul 24, 2026
One-click install
npx skills add https://github.com/eklyukin/my-ai-config --skill neo4j-spark-skill-eklyukin
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: neo4j-spark-skill
Source: https://github.com/eklyukin/my-ai-config/tree/main/skills/neo4j-spark-skill
Command: npx skills add https://github.com/eklyukin/my-ai-config --skill neo4j-spark-skill-eklyukin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Moving data between Neo4j and Spark or Databricks requires correct connector configuration, MERGE key mapping, and partition tuning; mistakes cause deadlocks, duplicate nodes, or out-of-memory failures. This Skill provides tested patterns for DataFrame reads and writes with the Neo4j Connector for Apache Spark. ## Core Features & Use Cases - DataFrame Reads: Load Neo4j data via label scans, Cypher queries, or relationship scans with partition and batch tuning. - DataFrame Writes: Write nodes with CREATE or MERGE (SaveMode.Append/Overwrite with node.keys) and relationships with source/target key mapping. - Databricks Integration: Cluster Maven installation, secrets-based credentials, and Delta Lake to Neo4j ingestion pipelines. - Use Case: Ingest a Delta Lake customers table into Neo4j as :Customer nodes with MERGE on customer_id, then write ORDERED relationships matching existing Customer and Product nodes. ## Quick Start Ask the assistant to write a PySpark job that reads a Delta table and writes it to Neo4j as nodes using the Neo4j Spark Connector with MERGE on a key column.

Frequently Asked Questions about neo4j-spark-skill

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a Spark DataFrame to Neo4j?▼

Use df.write.format("org.neo4j.spark.DataSource") with a SaveMode and a labels option for nodes or a relationship option for edges. For MERGE behavior use mode Overwrite together with the node.keys option, and create a uniqueness constraint on the key properties first.

How do I read Neo4j data into a Spark DataFrame?▼

Use spark.read.format("org.neo4j.spark.DataSource") with exactly one of three options: labels for node scans, query for custom Cypher with RETURN aliases as columns, or relationship with source and target label options. Tune partitions and batch.size for large graphs.

Does the Neo4j Spark Connector work with Databricks?▼

Yes, install the org.neo4j:neo4j-connector-apache-spark Maven library on the cluster matching the Scala version of your Databricks Runtime (12.2, 13.3, or 14.3 LTS). Use Single User access mode because Unity Catalog shared mode is not supported, and store credentials in Databricks secrets.

Why do relationship writes to Neo4j deadlock in Spark?▼

Deadlocks happen when multiple Spark partitions concurrently lock the same nodes during relationship writes. Apply coalesce(1) before the write so relationships are created from a single partition.

Why does Overwrite mode create duplicate nodes in Neo4j?▼

Overwrite uses MERGE on the properties listed in node.keys, so duplicates appear when no uniqueness constraint exists on those properties. Create a constraint such as CREATE CONSTRAINT ON (n:Label) ASSERT n.prop IS UNIQUE before writing.

When should I use the Neo4j Spark Connector instead of the Python driver?▼

Use the Spark Connector for bulk, parallel DataFrame reads and writes in Spark or Databricks jobs. Use the neo4j Python bolt driver for single-node applications, interactive queries, or transactional workloads outside Spark.