Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edge.replace() fails for edge with cardinality=ONE #591

Open
na-ka-na opened this issue Nov 23, 2021 · 1 comment
Open

edge.replace() fails for edge with cardinality=ONE #591

na-ka-na opened this issue Nov 23, 2021 · 1 comment
Labels
bug good_first_issue Good for newcomers wanting to contribute

Comments

@na-ka-na
Copy link

Example code:

class Site(StructuredNode):
   pass

class Node(StructuredNode):
   site = RelationshipTo('Site', 'site', cardinality=One)

site = Site()
node = Node()
node.site.connect(site)

site2 = Site()
node.site.connect(site2) # fails
node.site.replace(site2) # fails

# The only pattern that I could find that works is
existing_site = node.site.get_or_none()
if existing_site:
    node.site.reconnect(existing_site, site)
else:
    node.site.connect(site)

Suggestion: make replace() work so that we don't have to query the existing_site

@mariusconjeaud
Copy link
Collaborator

Checked this and I get an error too on replace for Cardinality=One. Marking as bug.

@mariusconjeaud mariusconjeaud added this to To do in Neomodel Maintenance via automation Aug 4, 2023
@mariusconjeaud mariusconjeaud added the good_first_issue Good for newcomers wanting to contribute label Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good_first_issue Good for newcomers wanting to contribute
Projects
Development

No branches or pull requests

2 participants