Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Neo4j Bolt driver for Python

License

NotificationsYou must be signed in to change notification settings

neo4j/neo4j-python-driver

Repository files navigation

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

Note

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

Alternative Installation for Better Performance

You may want to have a look at the available Rust extensions for this driverfor better performance. The Rust extensions are not installed by default. Formore information, seeneo4j-rust-ext.

Quick Example

fromneo4jimportGraphDatabase,RoutingControlURI="neo4j://localhost:7687"AUTH= ("neo4j","password")defadd_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",    )defprint_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,    )forrecordinrecords:print(record["friend.name"])withGraphDatabase.driver(URI,auth=AUTH)asdriver:add_friend(driver,"Arthur","Guinevere")add_friend(driver,"Arthur","Lancelot")add_friend(driver,"Arthur","Merlin")print_friends(driver,"Arthur")

Further Information


[8]ページ先頭

©2009-2025 Movatter.jp