Skip to main content

Neo4j Bolt driver for Python

Project description

This repository contains the official Neo4j driver for Python.

Driver upgrades within a major version will never contain breaking API changes.

For version compatibility with Neo4j server, please refer to: https://neo4j.com/developer/kb/neo4j-supported-versions/

  • Python 3.14 supported.

  • Python 3.13 supported.

  • Python 3.12 supported.

  • Python 3.11 supported.

  • Python 3.10 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-6.1.0.tar.gz (239.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neo4j-6.1.0-py3-none-any.whl (325.3 kB view details)

Uploaded Python 3

File details

Details for the file neo4j-6.1.0.tar.gz.

File metadata

  • Download URL: neo4j-6.1.0.tar.gz
  • Upload date:
  • Size: 239.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for neo4j-6.1.0.tar.gz
Algorithm Hash digest
SHA256 b5dde8c0d8481e7b6ae3733569d990dd3e5befdc5d452f531ad1884ed3500b84
MD5 e29c170d0d76961eadb231b4f6ad9f3d
BLAKE2b-256 1b01d6ce65e4647f6cb2b9cca3b813978f7329b54b4e36660aaec1ddf0ccce7a

See more details on using hashes here.

File details

Details for the file neo4j-6.1.0-py3-none-any.whl.

File metadata

  • Download URL: neo4j-6.1.0-py3-none-any.whl
  • Upload date:
  • Size: 325.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for neo4j-6.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3bd93941f3a3559af197031157220af9fd71f4f93a311db687bd69ffa417b67d
MD5 22a773082cd1c84fc43220abb5203294
BLAKE2b-256 705cee71e2dd955045425ef44283f40ba1da67673cf06404916ca2950ac0cd39

See more details on using hashes here.

Supported by

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