Hi and thank you for putting together this great library!
I have a question about the NodeSet interface - is there any way to filter all members of a NodeSet that have relationships with another NodeSet?
For example, given the following graph: [:Movie {genre: 'Action'}]<-[:PRODUCED_BY]-[:Studio {country: 'France'}]
, I can find all action movies with Movie.nodes.filter(genre='Action')
- but how do I narrow that down to action movies produced by French studios? It looks like there is a stub for doing this through has()
, but it is not implemented - is there some other way that I'm missing?
Movie.nodes.has(has_production_firm=Studio.nodes.filter(country='France'))
returns a NotImplementedError
.
Hi. I was wondering if the changes present in https://github.com/systum/neomodel were intended to be merged into the main repo and published to pypi? If so, is there anything I can do to help?
The changes in the systum repo are solving some issues I'm having in my production environment right now.
match
queries by a relationship property that's an array of string (using ArrayProperty) - I've tried the filtering methods listed here https://neomodel.readthedocs.io/en/latest/queries.html#node-sets-and-filtering that made sense (e.g. in, contains), but neither of them seems to do what I want.
class SourceN(DjangoNode):
title = StringProperty(unique_index=True)
class Source(models.Model):
title = models.CharField(max_length=128, unique=True)
def __str__(self):
return self.title
def delete(self, *args, **kwargs):
super(Source, self).delete(*args, **kwargs)
try:
source_n = SourceN.nodes.get_or_none(title=self.title)
if source_n:
source_n.delete()
except ModelDefinitionMismatch as e:
logger.error(e)
logger.error('neomodel node class registry: {}'.format(
e.current_node_class_registry))
def save(self, *args, **kwargs):
super(Source, self).save(*args, **kwargs)
SourceN.create_or_update({'title': self.title})
Is it possible to use Q
filters on a relation? I have a model that looks like what shown below,
and using a Q
filter raises a TypeError. Doing a AND
filter like user.bookmarks.filter(title__contains=query, url__contains=query)
works as expected. Im using the latest version of neomodel, on Python 3.7
class User(StructuredNode):
uid = UniqueIdProperty()
.
.
.
bookmarks = Relationship(Bookmark, 'SAVED')
class Bookmark(StructuredNode):
uid = UniqueIdProperty()
url = StringProperty()
title = StringProperty()
user.bookmarks.filter(Q(title__contains=query) | Q(url__contains=query))
Raises TypeError filter() takes 1 positional argument but 2 were given
Is there a way to retrieve the values of StructuredRel
properties in bulk?
Let's say I have
class MyLink(StructuredRel):
weight = IntegerProperty()
class MyNode(StructuredNode):
name = StringProperty()
neighbours = RelationshipTo('MyNode', 'NEIGHBOUR', model=MyLink)
I'm looking for something akin to query_set.values_list(field1, field2)
in django.
Let's say I have some node, I'm looking for something like:
some_node.neighbours.values_list('name', 'mylink__weight')
Which would return something like
[ ('node_k', 33), ('node_j', 12), ....]
{param}
is no longer supported. Please use $param
instead (line 1, column 18 (offset: 17))Hi Robin
We are facing issues for insert new node in neo4j version 4
I am using django_neomdel
After call function .save()
I am getting error this is old method
Please tell me is it any way to Use django_neomodel with neo4j version 4 (latest)
Error!
neobolt.exceptions.CypherSyntaxError: The old parameter syntax {param} is no longer supported. Please use $param instead (line 1, column 18 (offset: 17))
"CREATE (n:Person {create_params}) RETURN n"