Skip to main content

Neo4py

A proper documentation to neo4py is available here.

Introduction

Neo4py is an alternative to py2neo. I am trying my best to make it a perfect and better clone of the py2neo package.

How to run a query in neo4py

As it is a clone of py2neo so, I have added the similar functions like of py2neo so, that the users won't have the problem in migrating from py2neo to neo4py.

These are the steps you can use to execute a query in neo4py:


  1. First install neo4py using either pip or uv.
pip install neo4py

# or you can use uv for this

uv pip install neo4py

  1. Import the Graph class from the neo4py.

from neo4py.neo4py import Graph

  1. Create a graph object and pass your URI, and connection details to the Graph constructor.

graph = Graph("connection_uri",("user","db_password"))

# Example code
graph = Graph("bolt://localhost:7687",("neo4j","12345678"))

You can find your connection uri and user details, when you'll start your database and open neo4j browser. Password is the password that you have set while creating the database.


  1. Now make a python dictionary, pass the data to it, and run and write the query by using built-in run method.

data = {
    "name" : "John Doe",
    "age": 21
}
node = graph.run("CREATE (p:Person {name:$name,age:$age})", **data)

Final Words

For any issues, please open an issue. I am open for suggesstions, contributions, and collaborations.😊


Special Thanks to Aaron Moffatt for letting me acquire the name, "neo4py"

Metadata

Release files for neo4py 1.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for neo4py 1.1.5
File Size Uploaded
neo4py-1.1.5.tar.gz 9.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for neo4py 1.1.5
File Interpreter ABI Platform
neo4py-1.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 19.6 kB

Release files / neo4py-1.1.5.tar.gz

Download URL neo4py-1.1.5.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ed0d80f6569b2888a41c5a7ce27116a821d1a0365d82f1d8370b22d5d01c277c
BLAKE2b-256 checksum
How to use checksums
696ff92b02e5a88fdc9a67f7c007bef2bf01949afbd790044e518742067b33d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release files / neo4py-1.1.5-py3-none-any.whl

Download URL neo4py-1.1.5-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
459fdeb2d97cb69d8e985f374e2888a8fc4b557039479c82f8c30e6f389d97a3
BLAKE2b-256 checksum
How to use checksums
1c9f8eba14e9ced09a624c0d4a6266b283b867cf2bbf8bdcf81d5582da22cbba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page