Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neo4j 4.x Support #79

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

toddgrabowsky
Copy link

@toddgrabowsky toddgrabowsky commented Oct 20, 2020

Thanks for all the great work on neo4r! I made an attempt at updating the package to support Neo4j 4.x without impacting previous Neo4j versions.

From what I've read about the HTTP API for Neo4j 4.x, it appears that the result format is the same (so no updates to result parsing), but the following updates have been made:

  • the REST API endpoints have been deprecated (which means we need to write a cypher query to get constraints, indexes, labels, relationship_types, etc. for 4.x)
  • the transaction endpoint has changed from /db/data/transaction/commit to /db/{database_name}/tx/commit
  • the query statement parameters are now called using $param as opposed to {param} (https://neo4j.com/docs/http-api/current/actions/query-result/)

The updates in this PR basically contain some conditional logic to accommodate the 4.x way of doing things and the <4.x way of doing things. Would love to hear your thoughts to see if this is a good path for making neo4r compatible with Neo4j 4.x.

@davidlrosenblum
Copy link

davidlrosenblum commented Oct 20, 2020 via email

@toddgrabowsky
Copy link
Author

Thanks @davidlrosenblum ! Just added a new commit to fix the "con4" issue. Thanks for catching that.

To determine which version of Neo4j is being used, I'm basically looking at the structure of the results from a GET request to the root endpoint to try and determine 4.x or pre-4.x. Do you think that's a reasonable way to distinguish between 4.x and pre-4.x or is there a better way? Once we can infer the version of Neo4j, it's basically just some if-else logic to handle things pre vs. post 4.x.

@toddgrabowsky
Copy link
Author

@davidlrosenblum I like that you made "db" a public member of the Neo4j connection object. That makes a lot of sense as opposed to specifying the "db" as part of the call_neo4j function. I'll continue taking a look at your updates and would love to hear any thoughts/feedback about the changes I proposed. I'm sure there are probably a lot of use cases related to Neo4j 4.x Enterprise that haven't considered.

…j connection object as opposed to an argument in the "call_neo4j" function.
@davidlrosenblum
Copy link

davidlrosenblum commented Oct 22, 2020 via email

Grabowsky added 2 commits October 23, 2020 11:22
…d of a concatenated JSON string. The POST body format did not change in 4.x, just the query syntax for parameters, so the only thing that needs to be changed for 4.x versus pre-4.x is the POST URL. So the rest of the code for calling the Neo4j transactions endpoint can be the same regardless of Neo4j version.
…ument. Added a convenience function called neo4r_cypher for running a cypher query that just has the connection as the first argument (it just aligns more with the conventions from other database connection packages [e.g., DBI]).
@ColinFay
Copy link
Contributor

Thanks @toddgrabowsky for the awesome work!

I've just discussed with David that pointed that he's going to reuse some part of your code.

We'd love to list you as a contributor to the package one this all thing is merged, are you ok with being listed in the DESCRIPTION ?

@toddgrabowsky
Copy link
Author

@ColinFay that would be great! Thanks!

@fbiville
Copy link

Hi, is there any update on this pull request? Is it in a usable state?

@funarog
Copy link

funarog commented Apr 21, 2021

Is there an available update to connect to neo4j version 4?

@elliliao
Copy link

May I ask if there are updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants