Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

neo4j-driver

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

neo4j-driver

Neo4j Bolt driver for Python

  • 5.26.0
  • PyPI
  • Socket score

Maintainers
1

.. warning::

This package is deprecated and will stop receiving updates starting with
version 6.0.0. Please install ``neo4j`` instead (which is an alias, i.e.,
a drop-in replacement). See https://pypi.org/project/neo4j/ .

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:

.. code:: bash

pip install neo4j

.. TODO: 7.0 - remove this note

.. note::

``neo4j-driver`` is the old name for this package. It is now deprecated and
and will receive no further updates starting with 6.0.0. Make sure to
install ``neo4j`` as shown above.

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_.

.. _neo4j-rust-ext: https://github.com/neo4j/neo4j-python-driver-rust-ext

Quick Example

.. code-block:: python

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)
  • Neo4j Migration Guide_

.. _The Neo4j Operations Manual: https://neo4j.com/docs/operations-manual/current/ .. _The Neo4j Python Driver Manual: https://neo4j.com/docs/python-manual/current/ .. _Python Driver API Documentation: https://neo4j.com/docs/api/python-driver/current/ .. _Neo4j Cypher Cheat Sheet: https://neo4j.com/docs/cypher-cheat-sheet/ .. _Example Project: https://github.com/neo4j-examples/movies-python-bolt .. _GraphAcademy: https://graphacademy.neo4j.com/categories/python/ .. _Driver Wiki: https://github.com/neo4j/neo4j-python-driver/wiki .. _Neo4j Migration Guide: https://neo4j.com/docs/migration-guide/current/

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc