Skip to content

WIP: Allow Driver as argument to from_neo4j #169

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adamnsch
Copy link
Collaborator

Thank you for your contribution to the Graph Visualization for Python project by Neo4j.

Before submitting this PR, please read Contributing to the Neo4j Ecosystem.

Make sure:

  • You signed the Neo4j CLA (Contributor License Agreement) so that we are allowed to ship your code in our library
  • Your contribution is covered by tests

@adamnsch
Copy link
Collaborator Author

adamnsch commented May 23, 2025

Lets you do:

with GraphDatabase.driver(URI, auth=auth) as driver:
    VG = from_neo4j(driver)
    VG.render()

Comment on lines +49 to +53
graph = result.execute_query(
f"MATCH (n)-[r]->(m) RETURN n,r,m LIMIT {row_limit}",
routing_=RoutingControl.READ,
result_transformer_=Result.graph,
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think if we allow a driver here, we should also allow to specify a query here instead of the row_limit.
Otherwise we end up with building a Cypher query builder

Copy link
Collaborator Author

@adamnsch adamnsch May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I agree with that. If they want to do their own query they can do it first, and then just provide the Result. The idea of this is to make it so that they don't even have to make a query - that's the added value

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay if thats the main part, how about just passing the url + auth instead and we construct the client as well?

I think its always a bit to remember how to construct the driver (>0s)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a cool idea! I'll try it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I don't like is that it requires more parameters

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can have a dataclass to combine url + auth. gds has DbmsConnectionInfo now.

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.

2 participants