Django and Neo4j without Neo4Django

I am building a Django application with Neo4j (along with Postgres), I found this Django integration called neo4django , I was wondering if it would be possible to use only neo4restclient, for example, what would be the disadvantages of using Neo4django? Does the client only use neo4-rest-client, gives me more flexibility? When I created my models with Neo4Django, it seemed that there was no difference between db graph modeling and relational db. Did I miss something?

Thanks!

+8
django neo4j django-models neo4django
source share
1 answer

You can absolutely go with neo4j-rest-client or py2neo without using neo4django. In the same way, you can use any other database driver that you want to use at any time using Django, any REST client, etc.

What will you lose? DSL model, inline query (for example, Person.objects.filter(name="Mohamed") ), inline indexing and Lucene, Gremlin and Cypher behind it. Some things will be much simpler - for example, setting an arbitrary property on node, but you will need to learn more about how Neo4j works.

You will also lose some shortcuts. Django provides work with neo4django, such as get_object_or_404() and some of the class-based views that get_object_or_404() queries.

What do you get? Absolute DB power and easier DB performance tuning. Although neo4django is not as good as some traditional Python ORMs, the trade-off between power and lightness is similar.

However, they can work together - you can go down from neo4django to the base client REST nodes at any time. Just use model_instance.node to get the base neo4j-rest-client node object from the model and from neo4django.db import connection to get the wrapped neo4j-rest-client GraphDatabase .

That you are missing something: neo4django was written to reuse the powerful developer interface - Django ORM, so it should feel like Postgres models. In the past, I wrote a little about this odd feeling . I think part of the problem may be that lib does not highlight graph terminology that interests new graphical objects, expected as workarounds and pattern matching, and instead dresses these methods in Django query clothing.

I like your thoughts or know everything that you would like the library to do what it did not :) Good luck!

+9
source share

All Articles