neo4j / neo4j-python-driver

Neo4j Bolt driver for Python
https://neo4j.com/docs/api/python-driver/current/
Other
883 stars 187 forks source link

'Node' object has no attribute 'properties' #1055

Closed wjli-debug closed 2 months ago

wjli-debug commented 3 months ago

Why am I using pytho to manipulate the neo4j database schema and can't get the properties

Traceback (most recent call last):
  File "try.py", line 47, in <module>
    main()
  File "try.py", line 43, in main
    data_list = fetch_nodes_and_relations(driver)
  File "try.py", line 23, in fetch_nodes_and_relations
    'properties': record['n'].properties
AttributeError: 'Node' object has no attribute 'properties'
robsdedude commented 2 months ago

For support I generally refer to either of

I think the online community would be the best place for this.

I'd like to share some thoughts anyway: I'm wondering what made you believe that Node objects of the Python driver should have a properties attribute/property. If you check the API docs, you'll see that the node itself is similar to a dict. Assuming node =record["n"]andnodeactually being aNode, you can just access a given property like thisnode["someProperty"], or iterate over all key-property-pairs withnode.items()`.