Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Neo4j and django models

So, I'm looking into the Django and Neo4j integration, but there's not much about it out there ... What I want to know is if I have a model like the one here: If I want to add a new property to a model, it would be as simple as doing:

node.setProperty( "newProperty", "something" );

??

Moreover, all the queries in django would work ? How is the traversing made ?

I would appreciate any response :D

Thanks.

like image 804
Milena Araujo Avatar asked May 03 '11 07:05

Milena Araujo


2 Answers

We've been working on updating the Neo4j/Django integration to work with neo4j-rest-client - the fruits of our labor are on GitHub, with some quick comments on my blog.

There are some pros and cons to our integration. The most obviously impacting is our use of a REST client- you get to use a remote database, while losing quite a bit, performance-wise. OTOH, the integration works alongside a relational database, so you can still use django.contrib stuff that relies on the original ORM, and it handles indexing and query sets pretty nicely.

To do what you want above using neo4django, you'd simply get the neo4j-rest-client based node from the model instance, and have at it.

model_instance.node['newProperty'] = 'something'

We're still cranking on making the integration more dynamic, supporting traversals/etc in a Pythonic way, and (currently most important) improving the performance. If you're interested, I'd love feedback.

like image 165
Matt Luongo Avatar answered Sep 21 '22 18:09

Matt Luongo


Have you seen Tobias's blog post about Django integration? It's kinda old now, but still relevant. Plus there are examples you can check out too.

like image 20
Steve Jalim Avatar answered Sep 17 '22 18:09

Steve Jalim