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

Updating node attribute after object traversal is causing data loss #788

Open
slinkish opened this issue Feb 3, 2020 · 0 comments
Open

Comments

@slinkish
Copy link

slinkish commented Feb 3, 2020

I have nodes with a few attributes for example:

(_35682:LinkId {available: true, interface: '0/0/44', ip: '1.1.1.1', visible: true, x: 5, y: 5})

I am updating the availability in the following manner:
(node_obj is py2neo Node object that is directly linked to Node 35682)

local_links = graph.relationships.match((node_obj,))
int_nodes = [link.nodes[1]                                                  
                     for link in local_links]
for interface in int_nodes:                                                                                         
    interface['available'] = False                                      
    graph.push(interface)

The result from this code is:
(_35682:LinkId {available: false})

All other data or attributes are wiped in the neo4j database for this node.

Anytime I run through the process by hand and view the results and objects the code works as expected. Only faults when all lines run together.

I have worked around this issue with the following update :

local_links = graph.relationships.match((node_obj,))
int_nodes = [link.nodes[1]                                                  
                     for link in local_links]
for interface in int_nodes:
    graph.pull(interface)                                                                                         
    interface['available'] = False                                      
    graph.push(interface)

Not sure if this is expected behavior, I'm fairly new to this library but seems odd that data is loss with no exceptions or warnings. Any guidance is appreciated.

Hit issue with version: py2neo (4.3.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants