Created
January 19, 2023 18:35
-
-
Save jstenquist/429759a7780ce8c5ba33f215c6721ee8 to your computer and use it in GitHub Desktop.
Neo4j - Database export script for Graphene
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from neo4j import GraphDatabase | |
# Connect to the Neo4j database | |
driver = GraphDatabase.driver("neo4j+s://XXXXXXXXXX.graphenedb.com:24786", auth=("neo4j", "PASSWORD")) | |
session = driver.session() | |
# Export the database to a file in GraphML format | |
with open("export.graphml", "w") as file: | |
result = session.run("CALL apoc.export.graphml.query('MATCH (n) RETURN n', '', {})") | |
file.write(result.single()[0]) | |
# Close the session | |
session.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment