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

Docs needed for connecting to Memgraph from gqlalchemy #296

Closed
thedraketaylor opened this issue Jan 3, 2024 · 1 comment · Fixed by #297
Closed

Docs needed for connecting to Memgraph from gqlalchemy #296

thedraketaylor opened this issue Jan 3, 2024 · 1 comment · Fixed by #297
Labels
type: docs Improvements or additions to documentation

Comments

@thedraketaylor
Copy link

In docs/index.md, there is a line that states "Check the Python quick start guide to learn how to connect to Memgraph using GQLAlchemy."

However, the linked page states: "Both Neo4j Python client and GQLAlchemy can be used to connect to Memgraph with Python. This guide will show how to use Neo4j Python client and for more information on GQLAlchemy, check out its documentation."

There needs to be docs to explain how to connect to Memgraph using gqlalchemy.

@katarinasupe
Copy link
Contributor

Hi @thedraketaylor, thank you for reporting this. We moved the whole GQLAlchemy docs from Memgraph documentation and then we didn't catch that link. Thank you for pointing it out, I'll add it. Here is the code snippet for now:

from gqlalchemy import Memgraph

# Make a connection to the database
memgraph = Memgraph(host='127.0.0.1', port=7687)

# Delete all nodes and relationships
query = "MATCH (n) DETACH DELETE n"

# Execute the query
memgraph.execute(query)

# Create a node with the label FirstNode and message property with the value "Hello, World!"
query = """CREATE (n:FirstNode)
           SET n.message = '{message}'
           RETURN 'Node '  + id(n) + ': ' + n.message AS result""".format(message="Hello, World!")

# Execute the query
results = memgraph.execute_and_fetch(query)

# Print the first member
print(list(results)[0]['result'])

Also, refer to the tests for more examples.

@katarinasupe katarinasupe added the type: docs Improvements or additions to documentation label Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants