graphfoundation / ongdb

ONgDB is an independent fork of Neo4j® Enterprise Edition version 3.4.0.rc02 licensed under AGPLv3 and/or Community Edition licensed under GPLv3
https://www.graphfoundation.org/projects/ongdb/
380 stars 57 forks source link

support for Bolt protocols ('3.0', '4.1', '4.2', '4.3', '4.4', '5.0', '5.1', '5.2', '5.3', '5.4') - exception connecting with python neo4j #106

Open brunocek opened 5 months ago

brunocek commented 5 months ago

Hello.

I am trying to connect using a python script, and I am getting the bellow message:

neo4j._exceptions.BoltHandshakeError: The neo4j server does not support communication with this driver. This driver has support for Bolt protocols ('3.0', '4.1', '4.2', '4.3', '4.4', '5.0', '5.1', '5.2', '5.3', '5.4').

Are we completely out of compatibility with all these Bolt protocol versions? Is there an easy and accessible way to connect python to the ongdb backend, please?


Note: It seems related to this jira issue, but the server is down and archive.org has no record of it: [ONGDB-223] – Bolt version needs to be compatible with driver checks

( https://graphfoundation.org/ongdb/1.0.0-alpha01/ )

details to reproduce the error

  1. Create a python script file script.py:
    
    # script.py
    from neo4j import GraphDatabase

uri = 'bolt://localhost:7687' # or neo4j://localhost auth = ('ongdb', 'ongdb')

with GraphDatabase.driver(uri, auth=auth) as driver: driver.verify_connectivity()


2. Install python3 and pipenv (debian):

sudo apt-get install python3 pipenv


3. Create an environment on the same directory where the `script.py` lives, install `neo4j` python library and run the script:

pipenv shell pipenv install neo4j python script.py

bradnussbaum commented 5 months ago

ONgDB 1.0 uses Bolt protocol version 1.0. You will need to install and older python driver. Could you determine which python driver version dropped support?

brunocek commented 5 months ago

The release notes of version 5.1 contains a table of compatibility. It says version 3.5 and 4.0 are the two last ones that support certainly Bolt 1.7. ( https://pypi.org/project/neo4j/5.1.0/ )

Release notes for 4.1 to 5.0 will hold the description of how to use Bolt 1.7, but as we see in 5.1, they actually don't know if it works or not.

I use pipenv on debian, and I was unable to install an older version of python package neo4j:

ERROR: Could not find a version that satisfies the requirement neo4j4.0
ERROR: No matching distribution found for neo4j4.0

Please help and advise. It would be great to hear (have it documented) from users.

All release notes: ( https://pypi.org/project/neo4j/#history )


2024 programmatically use free software graph database

  1. What is the most valuable, free software, graph database, skill set to learn?

Should the programmatical use of the graph database be python via Bolt protocol on ongdb? Or should the connection use some different protocol?

  1. Do we need ongdb?

I recall reading that some queries are not available on neo4j personal (only paid enterprise) and that ongdb was forked to keep it, but unfortunately I cannot find the page where I read this.

( https://neo4j.com/pricing/ )( formaly /editions ) says on the paid professional:

Support for analytical queries with Parallel Runtime

Does it mean we cannot do some Cypher queries/graph algorithms (unless in paid enterprise)? Are these available in SPARQL? And is it a better choice?


My research now shows me only two functional limitations on neo4j personal:

My use case is not impacted by these neo4j personal limitations. On the other hand, at the moment, my research leads me to believe python with package neo4j and Bolt protocol is the best programmatical use of a free software graph db. Comments on this perception, please?

tracking (also asked on..)

brunocek commented 5 months ago

Quick updates:

Python's Neo4J driver won't support version 1. ( https://github.com/neo4j/neo4j-python-driver/issues/1013 )

I got this discusssion in neo4j forum where it should happen. - Centralises drivers discussion. ( https://community.neo4j.com/t/2024-programmatically-use-free-software-graph-database/66027 )


Does anyone use ongdb + python, please?

Or, is it possible to have ongdb support python current neo4j driver, please?

gambarim commented 3 months ago

I am also interested in this please

crazyyanchao commented 3 months ago

这是来自QQ邮箱的假期自动回复邮件。你好,我最近正在休假中,无法亲自回复你的邮件。我将在假期结束后,尽快给你回复。

bradnussbaum commented 3 months ago

You try this:

pip install neo4j==1.7.6

Then to execute a query:

from neo4j.v1 import GraphDatabase

# Define the connection URI
uri = "bolt://localhost:7687"
username = "your_username"
password = "your_password"

# Define your query
query = "MATCH (n) RETURN n LIMIT 5"

# Define a function to execute the query
def execute_query(uri, username, password, query):
    driver = GraphDatabase.driver(uri, auth=(username, password))
    session = driver.session()
    result = session.run(query)
    return result

# Execute the query
result = execute_query(uri, username, password, query)

# Process the result
for record in result:
    print(record)

I can get a better example if needed.

gambarim commented 3 months ago

Perfect it works. Thanks a lot