zoukankan      html  css  js  c++  java
  • 学习记录-py2neo:Neo4j数据库的python驱动

    安装:

    • 直接在命令行pip3 install py2neo
    • 官网下载(解压后放到python下的scripts中,在py2neo目录下cmd,输入python setup.py install

    链接

    auth=(用户名,密码)

    from py2neo import Graph,Node,Relationship
    graph = Graph("http://localhost:7474",auth=("neo4j","password"))
    
    • 问题:unauthorized(self.uri.string)

    • 解决方法:

      from py2neo import authenticate,Graph
      authenticate("localhost:7474","账号","密码")
      graph = Graph("http://localhost:7474/db/data")
      

    创建节点和关系

    (已通过batch-import导入,这步省略

    a = Node("Person", name="Alice")
    b = Node("Person", name="Bob")
    ab = Relationship(a, "KNOWS", b)
    graph.create(ab)
    

    查询

    查询节点(使用原生查询语句
    from py2neo import authenticate,Graph
    graph = Graph("http://localhost:7474",auth=("neo4j","password"))
    
    str = "match (变量名a:标签名{属性名:特定属性值}) return a"
    x = graph.run(str).data()
    y = pd.DataFrame(x)
    
  • 相关阅读:
    DIV+CSS笔记(二)
    DIV+CSS笔记(一)
    HTML基础笔记
    面向对象—封装—重载
    面向对象—封装
    面向对象—封装—people
    面向对象—封装—三角形
    权限修饰符—1
    权限修饰符—2(Father、Son)
    权限修饰符—3
  • 原文地址:https://www.cnblogs.com/l999q/p/13396022.html
Copyright © 2011-2022 走看看