Skip to main content

Neo4j Bolt driver for Python

Project description

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

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

neo4j_driver-5.28.1.tar.gz (231.2 kB view details)

Uploaded Source

Built Distribution

neo4j_driver-5.28.1-py3-none-any.whl (312.5 kB view details)

Uploaded Python 3

File details

Details for the file neo4j_driver-5.28.1.tar.gz.

File metadata

  • Download URL: neo4j_driver-5.28.1.tar.gz
  • Upload date:
  • Size: 231.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for neo4j_driver-5.28.1.tar.gz
Algorithm Hash digest
SHA256 1fae3968ac0546df1ad90575bc0531a0dfac3db140b9cb03349218229ea157e2
MD5 e33280d6c1512103f31acc4b92ebe1a6
BLAKE2b-256 cebbc3bc07953c3ae1fe37526ffb727e4dc3f1129aac818abe9923d23c67be88

See more details on using hashes here.

File details

Details for the file neo4j_driver-5.28.1-py3-none-any.whl.

File metadata

  • Download URL: neo4j_driver-5.28.1-py3-none-any.whl
  • Upload date:
  • Size: 312.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for neo4j_driver-5.28.1-py3-none-any.whl
Algorithm Hash digest
SHA256 531a9f3e34a2a560fe77779477953169eef6dbd1740008c0a04cc459ba53734a
MD5 e54b7918f64c3d828400683ae32e6054
BLAKE2b-256 5a4e2367baab52e0d3ac05c07092d196bbc917cdd4948ab5fedd17ac60d5189c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page