Neo4j Bolt driver for Python
Project description
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file neo4j-5.27.0.tar.gz
.
File metadata
- Download URL: neo4j-5.27.0.tar.gz
- Upload date:
- Size: 223.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f82ee807cd15b178898d83f41a66372e11719a25dd487fd7bea48fd4b7323765 |
|
MD5 | b28708bc957666c86b7d61689587e399 |
|
BLAKE2b-256 | 9cb631ed9f3df8b948aecd31952193b803cd2007551f2f81aaa60d264e8d1950 |
File details
Details for the file neo4j-5.27.0-py3-none-any.whl
.
File metadata
- Download URL: neo4j-5.27.0-py3-none-any.whl
- Upload date:
- Size: 301.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 929c14b9e5341267324eca170b39d1798b032bffacc26a0529eacaf678ae483f |
|
MD5 | 7588ba12b7883c2f61e83a1b8dceeb1c |
|
BLAKE2b-256 | f79acec819e5887804896db67b13215682b15e6f9201d9cf63890fee2b9a29e9 |