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

查看:245
本文介绍了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

I would appreciate any response :D

谢谢.

推荐答案

我们一直在更新Neo4j/Django集成以与在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'

我们仍在努力提高集成的动态性,以Python方式支持遍历/等,并(目前最重要的)提高性能.如果您有兴趣,我希望能提供反馈.

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天全站免登陆