Neo4j 和 django 模型 [英] Neo4j and django models

查看:46
本文介绍了Neo4j 和 django 模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我正在研究 Django 和 Neo4j 的集成,但关于它的内容并不多......我想知道的是我是否有一个像这里的模型:如果我想向模型添加一个新属性,就像这样做一样简单:

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" );

??

此外,django 中的所有查询都有效吗?遍历是如何进行的?

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

我将不胜感激:D

谢谢.

推荐答案

我们一直致力于更新 Neo4j/Django 集成以与 neo4j-rest-client - 我们的劳动成果是 在 GitHub 上,在我的博客上有一些简短的评论.

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.

我们的集成有一些优点和缺点.最明显的影响是我们使用 REST 客户端 - 您可以使用远程数据库,同时在性能方面损失很多.OTOH,集成与关系数据库一起工作,所以你仍然可以使用依赖原始 ORM 的 django.contrib 东西,它可以很好地处理索引和查询集.

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.

要使用 neo4django 执行上述操作,您只需从模型实例中获取基于 neo4j-rest-client 的节点,然后使用它即可.

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'

我们仍在努力使集成更加动态,以 Pythonic 的方式支持遍历/等,并且(目前最重要的)提高性能.如果您有兴趣,我很乐意提供反馈.

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.

这篇关于Neo4j 和 django 模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆