2016-08-10 16:39:02 +08:00
|
|
|
from neo4j.v1 import GraphDatabase, basic_auth
|
|
|
|
|
|
|
|
driver = GraphDatabase.driver("bolt://localhost",
|
|
|
|
auth=basic_auth("neo4j", "neo4j"),
|
|
|
|
encrypted=0)
|
|
|
|
|
|
|
|
session = driver.session()
|
2016-08-11 02:17:38 +08:00
|
|
|
# session.run("CREATE (a:Person {age:25})")
|
|
|
|
result = session.run("MATCH (a:Person) RETURN a.name AS name")
|
|
|
|
|
2016-08-10 16:39:02 +08:00
|
|
|
for record in result:
|
2016-08-11 02:17:38 +08:00
|
|
|
print(record["name"])
|
2016-08-10 16:39:02 +08:00
|
|
|
session.close()
|