neomodel icon indicating copy to clipboard operation
neomodel copied to clipboard

How can I add a new relationship property dynamically

Open gazambuja opened this issue 3 years ago • 1 comments

When I create some connections between nodes, I want to add some properties that not exist at the model of that Rel. How can I make this work?

class myRelationship(StructuredRel):
    prop1 = StringProperty()
    prop2 = IntegerProperty(default=0)

<--- how I can add newProp = StringProperty() dynamically here?

node1.myRelattionship.connect(node2, {"prop1": "value1", "prop2": 9999, "newProp": "new value"})

Thanks!

gazambuja avatar Jul 08 '22 14:07 gazambuja

@gazambuja I don't think you can do that. Your models have to be fixed. Perhaps what you could do in a circuitous way is use a JSONProperty.

enjoysmath avatar Aug 05 '22 19:08 enjoysmath

Adding properties dynamically is not supported in neomodel and currently not a development target. The only option for you here is a JSONProperty, as @enjoysmath said.

AntonLydike avatar Sep 18 '22 08:09 AntonLydike