Neo4j Bolt Driver 1.7 for Python

The Official Neo4j Driver for Python supports Neo4j 3.2 and above and requires Python version 2.7 or 3.4+. Note that support for Python 2.7 will be removed in the 2.0 driver.

Quick Example

from neo4j import GraphDatabase

uri = "bolt://localhost:7687"
driver = GraphDatabase.driver(uri, auth=("neo4j", "password"))

def print_friends_of(tx, name):
    for record in tx.run("MATCH (a:Person)-[:KNOWS]->(f) "
                         "WHERE a.name = {name} "
                         "RETURN f.name", name=name):
    print(record["f.name"])

with driver.session() as session:
    session.read_transaction(print_friends_of, "Alice")

Note

While imports from neo4j.v1 still work, these will be removed in the 2.0 driver. It is therefore recommended to change all imports from neo4j.v1 to neo4j.

Installation

To install the latest stable driver release, use:

pip install neo4j

Note

The driver is currently released under two package names on PyPI: neo4j and neo4j-driver. Installing from neo4j is recommended since neo4j-driver will be removed in a future release.

Other Information