Skip to content

Instantly share code, notes, and snippets.

@jeanmidevacc
Last active May 12, 2020 02:48
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 jeanmidevacc/716c68631d3e72da8e80057438d5cf67 to your computer and use it in GitHub Desktop.
Save jeanmidevacc/716c68631d3e72da8e80057438d5cf67 to your computer and use it in GitHub Desktop.
neo4j_set_nodes.py
from neo4j import GraphDatabase
# Declare the connector to the graph database
uri = "bolt://localhost:7687"
driver = GraphDatabase.driver(uri, auth=("neo4j", "pwd"), encrypted=False)
# Define the node properties
node = {
'url': 'https://bsaber.com/members/jeanmidev/',
'picture': 'https://bsaber.com/wp-content/uploads/avatars/89910/5e99a50d31e27-bpfull.png',
'id': 'jeanmidev'
}
# Build the statement to deploy the node
statement = f"CREATE (u:User {url : $url,picture : $picture,id : $id})"
# Execute the statement
with driver.session() as session:
session.run(statement, node)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment