ORM with graphical databases like Neo4j in Python

I am wondering if there is an ORM solution (or need) with Graph-Database (fe Neo4j). I keep track of the relationship (A is connected to B, which is connected to A through C, etc., Thus, creating a large graph) of objects (including additional attributes for these objects) and should store them in the database, and I think that graphical The database is perfect for this task.

Now, using sql-like databases, I use sqlalchemyś ORM to store my objects, especially due to the fact that I can extract objects from db and work with them in a pythonic style (use their methods, etc.).

Is there any solution for object mapping for Neo4j or another Graph-DB so that I can store and retrieve python objects in and out of Graph-DB and work with them easily?

Or could you write some functions or adapters, for example, in the sqlite python documentation (http://docs.python.org/library/sqlite3.html#letting-your-object-adapt-itself) to retrieve and store objects?

+16
source share
3 answers

Python currently has several options based on REST database interfaces.

As I mentioned in the @Peter link above, we are working on neo4django, which updates the old Neo4j / Django integration. This is a good choice if you need complex queries and you want an ORM that will manage indexing the node as well-, or if you are already using Django. It works very similar to the native Django ORM. Find it on PyPi or GitHub .

There is also a more general solution called Bulbflow , which should work with any graph database supported by Blueprints. I have not used it, but from what I saw, it focuses on domain modeling - in Bulbflow, for example, there are already working relationship models that we are still working on- but do not really support complex queries (how do we with Django query sets + index usage). It also allows you to work a little closer to the schedule.

+6
source

Shameless plugin ... there is also my own ORM, which you can also check: https://github.com/robinedwards/neomodel

It is built on top of py2neo using the cypher and rest API calls under the hood, i.e. no dependence on gremlin.

+10
source

Maybe you could take a look at Bulbflow , which allows you to create models in Django, Flask or Pyramid. However, it works through a REST client instead of the python binding provided by Neo4j, so it may not be as fast as the native binding.

+7
source

Source: https://habr.com/ru/post/1444896/


All Articles