21

i wonder wether there is a solution (or a need for) an ORM with Graph-Database (f.e. Neo4j). I'm tracking relationships (A is related to B which is related to A via C etc., thus constructing a large graph) of entities (including additional attributes for those entities) and need to store them in a DB, and i think a graph database would fit this task perfectly.

Now, with sql-like DBs, i use sqlalchemyś ORM to store my objects, especially because of the fact that i can retrieve objects from the db and work with them in a pythonic style (use their methods etc.).

Is there any object-mapping solution for Neo4j or other Graph-DB, so that i can store and retrieve python objects into and from the Graph-DB and work with them easily?

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

1

3 Answers 3

14

Shameless plug... there is also my own ORM which you may also want to checkout: https://github.com/robinedwards/neomodel

It's built on top of py2neo, using cypher and rest API calls under hood, i.e no dependency on gremlin.

Sign up to request clarification or add additional context in comments.

2 Comments

Note: neomodel is not built on top of py2neo anymore, but on the official neo4j-driver.
Wow, I went in expecting the repo to be completely deprecated, but it looks like it's had a lot of work put in, kudos!
7

There are a couple choices in Python out there right now, based on databases' REST interfaces.

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

There's also a more general solution called Bulbflow that is supposed to work with any graph database supported by Blueprints. I haven't used it, but from what I've seen it focuses on domain modeling - Bulbflow already has working relationship models, for example, which we're still working on- but doesn't much support complex querying (as we do with Django querysets + index use). It also lets you work a bit closer to the graph.

3 Comments

Bulbflow seems quite nice, i´ll have a look at it. Is it bound to Flask etc. or can you use it "standalone" ?(i think so). Neo4j Django looks good, too, but i´d like to have a plattform/framework-independent or standalone-solution (which could be bound to a framework later on).
From what I understand Bulbflow can be used standalone. @versae's answer seems to agree. And because I'm always selling- despite the name, so can neo4django- it has a few code dependencies on Django but doesn't require you to use the actual framework :)
Answer is not relevant anymore: both neo4django and bulbflow are abandoned. A more recent OGM (Object-Graph-Mapper) is neomodel, and django-neomodel if you're using Django.
7

Maybe you could take a look on Bulbflow, that allows to create models in Django, Flask or Pyramid. However, it works over a REST client instead of the python-binding provided by Neo4j, so perhaps it's not as fast as the native binding is.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.