############################# graphdbapi Python |version| ############################# Python versions supported: * Python 3.10 * Python 3.9 * Python 3.8 * Python 3.7 使用规范 ============== API封装了连接池,并且会在API方法执行后自动回收。但是部分方法需要用户把结果消费完毕后才会回收。 **以下需要手动释放** - 执行OpenCypher查询相关的方法 - 返回值为迭代器对象的方法 **释放方式** 对结果进行迭代,迭代完毕及释放。 **未释放后果** 若未释放会导致连接一直被占用,当被占用的连接数等于连接池size的时候,driver将无法申请到新的连接。 Topics ============== **API** + :ref:`OpenCypher` + :ref:`Vertex` + :ref:`Edge` + :ref:`Algorithm` + :ref:`Schema` + :ref:`Graph` + :ref:`Property` + :ref:`GraphGroup` .. toctree:: :hidden: apis/cypher.rst apis/vertex.rst apis/edge.rst apis/algorithm.rst apis/schema.rst apis/graph.rst apis/property.rst apis/graph_group.rst **others** + :ref:`enum` + :ref:`otherAPI` .. toctree:: :hidden: extends/enum.rst extends/api.rst Installation ============== 使用本地.whl文件进行安装 .. code:: bash pip install {PATH}/graphdbapi-20210413-py3-none-any.whl .. note:: 此项目存在外部依赖请确保安装。 - pytz 示例 ============== .. code:: python # 导入驱动模块 from graphdbapi.db import GraphDb # 图服务链接参数 # 图服务所在地址及其端口 uri = 'bolt://192.168.20.15:7687' # 图名称 graph_name = 'test' # 合法用户名 user = 'admin' # 合法用户密码 password = 'admin' # 连接图服务 driver = GraphDb.connect(uri, user, password) graph = GraphDb.driver_by_name(driver, graph_name) # 查询10个点 cypher = "MATCH (n) RETURN n limit 10" for i in graph.execute_cypher(cypher, None): print(i) driver.close()