Skip to content

Instantly share code, notes, and snippets.

@ruliana
Last active January 12, 2018 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruliana/d23bd5f430eaca7ddbceb10b594bd986 to your computer and use it in GitHub Desktop.
Save ruliana/d23bd5f430eaca7ddbceb10b594bd986 to your computer and use it in GitHub Desktop.
A deep nesting example in Python
from neo4j.v1 import GraphDatabase
import csv
cypher = "MATCH yadda-yadda-yadda"
header = ["x", "y"]
with open(file, "w") as output:
writer = csv.writer(output)
writer.writerow(headers)
with GraphDatabase.driver("bolt://localhost:7687") as driver:
with driver.session() as session:
with session.begin_transaction() as tx:
for record in tx.run(cypher):
writer.writerow([record[header] for header in headers])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment