Skip to content

Instantly share code, notes, and snippets.

@elijahbenizzy
Created June 20, 2024 17:32
Show Gist options
  • Save elijahbenizzy/f34f875d7c43676f4b56214bd0ed3a5c to your computer and use it in GitHub Desktop.
Save elijahbenizzy/f34f875d7c43676f4b56214bd0ed3a5c to your computer and use it in GitHub Desktop.
def run_cypher_query(graph, query):
try:
results = graph.ro_query(query).result_set
except:
results = {"error": "Query failed please try a different variation of this query"}
if len(results) == 0:
results = {
"error": "The query did not return any data, please make sure you're
"using the right edge directions and you're following the
"correct graph schema"}
return str(results)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment