Thanks for your reply Dana. I am able to run the following code using the Neo4j Bolt Driver for Python. Everything works fine. I load the data into a database and then the friend names do get printed.
import sys, time
from neo4j import GraphDatabase
#url = "bolt://localhost:7687"
url = "bolt://localhost:11002"
driver = GraphDatabase.driver(url, auth=("neo4j", "xxxxx"))
def add_friend(tx, name, friend_name):
tx.run("MERGE (a:Person {name: $name}) "
"MERGE (a)-[:KNOWS]->(friend:Person {name: $friend_name})",
name=name, friend_name=friend_name)
def print_friends(tx, name):
for record in tx.run("MATCH (a:Person)-[:KNOWS]->(friend) WHERE a.name = $name "
"RETURN friend.name ORDER BY friend.name", name=name):
print(record["friend.name"])
with driver.session() as session:
session.write_transaction(add_friend, "Arthur", "Guinevere")
session.write_transaction(add_friend, "Arthur", "Lancelot")
session.write_transaction(add_friend, "Arthur", "Merlin")
session.read_transaction(print_friends, "Arthur")
print("Successful completion of program")
But in Neo4j Desktop, I previously loaded the contents of 605,000 rows of data from a csv file into a database called Emails and I want to be able to access that graph database in my python program. If this were possible, I would expect to have to provide the name of my database somewhere but I haven't seen any examples yet where this is being done. I'm wondering if it's even possible to do this with Neo4j Desktop. Maybe I need the Enterprise version? I've been doing a lot of reading... If it is possible to do what I'm asking with Neo4j Desktop and a code example could be provided of how it's done, I'd very much appreciate it.
Don