简体   繁体   English

Python和图形数据库。 使用java lib包装器还是REST api?

[英]Python and graph database. Use java lib wrapper or REST api?

I want to ask you about the best way to use graph database (Neo4j) in Python. 我想问你在Python中使用图形数据库(Neo4j)的最佳方法。 What you think, should I use "neo4j/python-embedded" ( neo4j/python-embedded with JPype) or maybe "bulbflow" ( bulbflow , with Rexster, Gremlin and REST api)? 您的想法,我应该使用“neo4j / python-embedded”( neo4j / python-embedded with JPype)还是“bulbflow”( bulbflow ,使用Rexster,Gremlin和REST api)? Is REST api secure and provides high availability (eg 500 000+ users)? REST api是否安全并提供高可用性(例如500,000+用户)?

Thank you. 谢谢。

I think Bulbs against Neo4j Server might be the best combination. 我认为针对Neo4j Server的灯泡可能是最好的组合。 Also, you can set up Neo4j in High Availability mode so multiple instances are forming a cluster, http://docs.neo4j.org/chunked/snapshot/ha.html which should take care of your load scenario. 此外,您可以在高可用性模式下设置Neo4j,以便多个实例形成一个群集, http://docs.neo4j.org/chunked/snapshot/ha.html ,它应该处理您的负载情况。

You can use Bulbs ( http://bulbflow.com/) with Neo4j Server or Rexster: 您可以在Neo4j Server或Rexster中使用Bulbs( http://bulbflow.com/)

>>> from bulbs.neo4jserver import Graph
>>> g = Graph()
>>> g.vertices.create(name="James")
>>> g.vertices.create(name="Julie")
>>> g.edges.create(james, "knows", julie)

Or to use Rexster, just change the import: 或者使用Rexster,只需更改导入:

>>> from bulbs.rexster import Graph
>>> g = Graph()
>>> g.vertices.create(name="James")
>>> g.vertices.create(name="Julie")
>>> g.edges.create(james, "knows", julie)

Note though with Rexster, it supports multiple graph databases so make sure you change the default DB URI in the config: 注意使用Rexster,它支持多个图形数据库,因此请确保更改配置中的默认DB URI:

>>> from bulbs.rexster import Graph, Config
>>> config = Config('http://localhost:8182/graph/neo4jsample')
>>> g = Graph(config)
>>> ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM