Neo4j Bolt Driver for Python
This repository contains the official Neo4j driver for Python.
Starting with 5.0, the Neo4j Drivers will be moving to a monthly release cadence. A minor version will be released on the last Friday of each month so as to maintain versioning consistency with the core product (Neo4j DBMS) which has also moved to a monthly cadence.
As a policy, patch versions will not be released except on rare occasions. Bug fixes and updates will go into the latest minor version and users should upgrade to that. Driver upgrades within a major version will never contain breaking API changes.
See also: https://neo4j.com/developer/kb/neo4j-supported-versions/
Python 3.13 supported (since driver version 5.26.0).
Python 3.12 supported (since driver version 5.14.0).
Python 3.11 supported (since driver version 5.3.0).
Python 3.10 supported.
Python 3.9 supported.
Python 3.8 supported.
Python 3.7 supported.
Installation
To install the latest stable version, use:
pip install neo4j
Alternative Installation for Better Performance
You may want to have a look at the available Rust extensions for this driver for better performance. The Rust extensions are not installed by default. For more information, see neo4j-rust-ext.
Quick Example
from neo4j import GraphDatabase, RoutingControl
URI = "neo4j://localhost:7687"
AUTH = ("neo4j", "password")
def add_friend(driver, name, friend_name):
driver.execute_query(
"MERGE (a:Person {name: $name}) "
"MERGE (friend:Person {name: $friend_name}) "
"MERGE (a)-[:KNOWS]->(friend)",
name=name, friend_name=friend_name, database_="neo4j",
)
def print_friends(driver, name):
records, _, _ = driver.execute_query(
"MATCH (a:Person)-[:KNOWS]->(friend) WHERE a.name = $name "
"RETURN friend.name ORDER BY friend.name",
name=name, database_="neo4j", routing_=RoutingControl.READ,
)
for record in records:
print(record["friend.name"])
with GraphDatabase.driver(URI, auth=AUTH) as driver:
add_friend(driver, "Arthur", "Guinevere")
add_friend(driver, "Arthur", "Lancelot")
add_friend(driver, "Arthur", "Merlin")
print_friends(driver, "Arthur")
Further Information
The Neo4j Operations Manual (docs on how to run a Neo4j server)
The Neo4j Python Driver Manual (good introduction to this driver)
Python Driver API Documentation (full API documentation for this driver)
Neo4j Cypher Cheat Sheet (summary of Cypher syntax - Neo4j’s graph query language)
Example Project (small web application using this driver)
GraphAcademy (interactive, free online trainings for Neo4j)
Driver Wiki (includes change logs)
Release files for neo4j 5.28.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| neo4j-5.28.6.tar.gz | 233.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| neo4j-5.28.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 547.3 kB
Release files / neo4j-5.28.6.tar.gz
| Download URL | neo4j-5.28.6.tar.gz |
|---|---|
| Size | 233.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
224020cb649517cba1b76bf94129ccf84de30e7005932b5ab0cdd9cb566d55b2
|
|
BLAKE2b-256 checksum How to use checksums |
77eaa17b0df723422cb3124bd45e6570d9677eafa38ffa207c3d12f601cbb90e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Release files / neo4j-5.28.6-py3-none-any.whl
| Download URL | neo4j-5.28.6-py3-none-any.whl |
|---|---|
| Size | 313.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5454b51e0a1de870e7d0cc233b8897bb8b3a273fe32458ccbcde9d5a604f7437
|
|
BLAKE2b-256 checksum How to use checksums |
cd9cec2a2f4b9fbb6c93d51c785a8c4e4cdca280009b7ad0821ff145e6cb02a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|