I'm able to make a query to a graph database like this
from neo4j import GraphDatabase
#establish connection
graphdp = GraphDatabase.driver(uri="bolt://localhost:7687", auth=("neo4j","Python"))
session = graphdp.session()
q1="MATCH (n {id:0}) return n"
nodes = session.run(q1)
for node in nodes:
print(node)
The result is:
<Record n=<Node id=5 labels={'Ubuntu1604'} properties={'host_image': 'qsrf-56fh-3db5-xd4t', 'id': 0}>>
<Record n=<Node id=6 labels={'Ubuntu1804'} properties={'host_image': 'qsrf-56fh-3dd4-44ty', 'id': 0}>>
<Record n=<Node id=7 labels={'Network'} properties={'start': '', 'capability': 'connection', 'cidr': '', 'end': '', 'nameservers': '[10.0.71.254, 8.8.4.4, 8.8.8.8]', 'id': 0}>>
<Record n=<Node id=8 labels={'Port'} properties={'port_ip': '', 'requirement': '["container","connection"]', 'id': 0}>>
<Record n=<Node id=13 labels={'GuestLinuxUser'} properties={'id': 0, 'playbook': 'createLinuxUser'}>>
<Record n=<Node id=16 labels={'GuestWindowsUser'} properties={'id': 0, 'playbook': 'createWindowsUser'}>>
Process finished with exit code 0
How can I access each node property?
(results[0])
I get<Record n=<Node id=5 labels={'Ubuntu1604'} properties={'host_image': 'qsrf-56fh-3db5-xd4t', 'id': 0}>>
. How do I access for example "host_image" value? – Fiddler