Skip to content

Instantly share code, notes, and snippets.

@jalakoo
Last active June 7, 2022 16:03
Show Gist options
  • Save jalakoo/f5774b14193219aaf1eb8fa9e520442c to your computer and use it in GitHub Desktop.
Save jalakoo/f5774b14193219aaf1eb8fa9e520442c to your computer and use it in GitHub Desktop.
Neo4j Simple Example
from neo4j import GraphDatabase, unit_of_work
uri = ""
username = ""
password = ""
driver = GraphDatabase.driver(uri, auth=(username, password))
@unit_of_work(timeout=30)
def generic_function(tx, **kwargs):
result = tx.run("MATCH (n) RETURN n", **kwargs)
return list(result)
with driver.session() as session:
result = session.read_transaction(generic_function)
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment