from neo4j import GraphDatabase
# uri = "neo4j://192.168.88.161:7687" # 4.x版本用这个
uri = "bolt://192.168.40.102:7687" # 3.x版本用这个
driver = GraphDatabase.driver(uri, auth=("neo4j", "000000"), max_connection_lifetime=1000)
# 直接用python代码形式访问节点Company, 并返回所有节点信息
with driver.session() as session:
cypher = "CREATE(c:Company) SET c.name='黑马程序员' RETURN c.name"
record = session.run(cypher)
result = list(map(lambda x: x[0], record))
print("result:", result)
neo4j不同版本的连接方式
最新推荐文章于 2024-07-20 12:33:18 发布