{"id":9473,"library":"apache-airflow-providers-neo4j","title":"Apache Airflow Neo4j Provider","description":"This Apache Airflow provider package integrates Apache Airflow with Neo4j, allowing users to define DAGs that interact with Neo4j graph databases. It provides hooks, operators, and sensors for executing Cypher queries, managing data, and moving data between Neo4j and other systems. It is actively maintained as part of the Apache Airflow ecosystem, with releases typically aligning with Airflow's own release schedule or as needed for bug fixes and new features. Current version: 3.11.5.","status":"active","version":"3.11.5","language":"en","source_language":"en","source_url":"https://github.com/apache/airflow/tree/main/airflow/providers/neo4j","tags":["airflow","provider","neo4j","graph database","etl","data orchestration"],"install":[{"cmd":"pip install apache-airflow-providers-neo4j","lang":"bash","label":"Install provider"}],"dependencies":[{"reason":"Required Python driver for interacting with Neo4j databases.","package":"neo4j","optional":false}],"imports":[{"note":"Airflow 2.0+ uses provider packages; 'contrib' paths are deprecated and removed.","wrong":"from airflow.contrib.hooks.neo4j_hook import Neo4jHook","symbol":"Neo4jHook","correct":"from airflow.providers.neo4j.hooks.neo4j import Neo4jHook"},{"note":"Airflow 2.0+ uses provider packages; 'contrib' paths are deprecated and removed.","wrong":"from airflow.contrib.operators.neo4j_operator import Neo4jOperator","symbol":"Neo4jOperator","correct":"from airflow.providers.neo4j.operators.neo4j import Neo4jOperator"},{"symbol":"Neo4jToNeo4jOperator","correct":"from airflow.providers.neo4j.operators.neo4j import Neo4jToNeo4jOperator"}],"quickstart":{"code":"from __future__ import annotations\n\nimport pendulum\n\nfrom airflow.models.dag import DAG\nfrom airflow.providers.neo4j.operators.neo4j import Neo4jOperator\n\n# Ensure you have a Neo4j connection configured in Airflow UI.\n# Conn Id: neo4j_default, Conn Type: Neo4j\n# Host: bolt://localhost:7687 (or your Neo4j URI)\n# Login: neo4j (or your username)\n# Password: your_password\n# Extra: {'database': 'neo4j'} (if using specific database)\n\nwith DAG(\n    dag_id=\"neo4j_simple_example\",\n    start_date=pendulum.datetime(2023, 1, 1, tz=\"UTC\"),\n    schedule=None,\n    catchup=False,\n    tags=[\"neo4j\", \"example\"],\n) as dag:\n    create_node = Neo4jOperator(\n        task_id=\"create_test_node\",\n        neo4j_conn_id=\"neo4j_default\",\n        cypher_query=\"CREATE (n:TestNode {name: 'Airflow Test'}) RETURN n\",\n    )\n\n    read_node = Neo4jOperator(\n        task_id=\"read_test_node\",\n        neo4j_conn_id=\"neo4j_default\",\n        cypher_query=\"MATCH (n:TestNode {name: 'Airflow Test'}) RETURN n.name\",\n    )\n\n    clean_up = Neo4jOperator(\n        task_id=\"clean_up_node\",\n        neo4j_conn_id=\"neo4j_default\",\n        cypher_query=\"MATCH (n:TestNode {name: 'Airflow Test'}) DELETE n\",\n    )\n\n    create_node >> read_node >> clean_up\n","lang":"python","description":"This example DAG demonstrates how to use the `Neo4jOperator` to execute Cypher queries against a Neo4j database. It creates a node, reads its property, and then cleans it up. Before running, ensure you have configured a 'Neo4j' connection in the Airflow UI with the `conn_id` set to `neo4j_default` (or your chosen ID) and correct credentials and host."},"warnings":[{"fix":"Update import paths from `airflow.contrib.hooks.neo4j_hook` to `airflow.providers.neo4j.hooks.neo4j` and similar for operators and sensors.","message":"Airflow 2.0+ introduced a new provider package structure. All imports from `airflow.contrib` are deprecated and removed in Airflow 2.0 and later.","severity":"breaking","affected_versions":"Airflow 2.0.0 and newer"},{"fix":"Ensure 'Conn Id', 'Host', 'Port', 'Login', and 'Password' are correct. For 'Neo4j AuraDB' or instances requiring a specific URI, set 'Host' to the URI (e.g., 'bolt://localhost:7687') and optionally specify 'database' in the 'Extra' JSON field, e.g., `{\"database\": \"neo4j\"}`.","message":"Neo4j connection configuration in the Airflow UI can be tricky, especially for Neo4j AuraDB or specific configurations.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Check the `neo4j` Python driver's compatibility matrix with your Neo4j server version. This provider explicitly depends on `neo4j>=5.0.0`, which implies compatibility with Neo4j 5.x servers. Ensure your Neo4j instance is compatible or consider adjusting the `neo4j` driver version if issues arise.","message":"The underlying `neo4j` Python driver (installed as a dependency of this provider) must be compatible with your Neo4j database server version.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Run `pip install apache-airflow-providers-neo4j` in the environment where your Airflow worker/scheduler/webserver runs. Verify your import statement matches `from airflow.providers.neo4j.hooks.neo4j import Neo4jHook`.","cause":"The `apache-airflow-providers-neo4j` package is not installed in your Airflow environment, or the import path is incorrect.","error":"ModuleNotFoundError: No module named 'airflow.providers.neo4j.hooks.neo4j'"},{"fix":"Navigate to `Admin -> Connections` in the Airflow UI. Edit your Neo4j connection (e.g., `neo4j_default`) and carefully verify the 'Login' and 'Password' fields against your Neo4j database credentials.","cause":"Incorrect username or password configured in the Airflow Neo4j connection details.","error":"neo4j.exceptions.AuthError: The client is unauthorized to perform this request."},{"fix":"Update your import statement to `from airflow.providers.neo4j.operators.neo4j import Neo4jOperator` and ensure the `apache-airflow-providers-neo4j` package is installed and Airflow is version 2.0 or newer.","cause":"You are attempting to use a deprecated and removed import path from `airflow.contrib` which was used in Airflow 1.x.","error":"AttributeError: module 'airflow.contrib.operators.neo4j_operator' has no attribute 'Neo4jOperator'"}]}