OK after playing around with this for a bit it looks like where you're running into problems is how you've structured your query by just returning the name or even as name you're returning something a little different than you think. What you need to do is return the entire member so:
match (m:Member) return m
and then you can pull the name off the record object returned. Now bear in mind I'm doing with the neo4j python driver and not the py2neo driver but on a similar query this is what happens for me. In my use case I'm querying a list of wells so I do this, I have a function I call:
def get_wells(tx):
wells = []
for record in tx.run('MATCH (w:Well)'
'return w'):
wells.append(record)
return wells
which returns a neo4j record object. I can then loop through the resulting records by doing:
for well in wells:
print(well['w']['name'])
This works because it returns a full record object from neo4j. When I tried it your way:
def get_well_names(tx):
wells = []
for record in tx.run(
'''
MATCH (w:Well)
return w.name as name
'''
):
wells.append(record)
return wells
I received a different object back that had the key of w.name but not actually the name itself. So maybe give that a try just remember that whatever you return from the function the starting key of that record object will be that. In my case when I say return
w
then that's the key for the record. I can then get the properties:
print(well['w'].__dict__)
_graph': <neo4j.types.graph.Graph object at 0x10b5c3190>,
'_id': 36885,
'_labels': {'Well'},
'_properties': {'OGL': 'Adobe 1967-12-26',
'abstract': '1025',
'checkString': '{"api_number": "4247536868", "Field": '
'"PHANTOM", "producing_date": '
'"2016-06-01T00:00:00Z", "Operator": '
'"CONCHOOPERATING", "Entities": "129529900", '
'"reported_operator": "COGOPERATINGLLC", '
'"target_formation": "WOLFCAMP", '
'"well_status": "ACTIVE"}',
'completionDate': '2015-05-24',
'county': 'Ward',
'dateInPay': '2017-03-01',
'dateProducing': '2016-06-01',
'dpu': 'V1052 P753',
'drillType': 'H',
'familyID': '1305-00',
'id': '42-475-36868',
'inService': True,
'inactive': False,
'landId': 'TX-W-B33-S35',
'latitude': '31.443879',
'latitudeBottom': '31.4328446',
'lengthOfLateral': '4955 ft, 0.94 miles',
'lmsltDOI': '0.00275953',
'longitude': '-103.3354631',
'longitudeBottom': '-103.3472174',
'lowerPerf': '15890',
'mesDOI': '0.00275953',
'mpiDivOrder': '2017-05-30',
'name': 'Barstow 33-34 1H',
'notes': 'Commingle Permit 7604',
'ogl': 'Adobe 1967-12-26',
'oilPayor': 'COG Operatig LLC.',
'operator': 'COG OPERATING LLC',
'p12': '2014-10-02',
'payor': 'COG',
'perfLength': '4890',
'permitDate': '2015-10-30',
'permitNumber': '797594',
'plat': '',
'platURL': 'http://monroeprop.ddns.net/WELLS/2014-10-01-Plat-Jetta-Barstow_33-34_1H_notes.pdf',
'producingFormation': 'WOLFCAMP',
'productionFormation': 'Cherry Canyon',
'rccField': 'Two Georges(Bone Springs) ',
'rigRelease': '2015-05-24',
'rigReleaseDate': '2015-05-24',
'rrcField': 'PHANTOM',
'rrcLeaseNumber': '47050',
'spudDate': '2015-04-27',
'state': 'Texas',
'status': 'Active',
'totalDepth': '16108',
'trueVerticalDepth': '10670.19',
'type': 'Oil',
'upperPerf': '11000'}}
Sorry for the long rambling post but I think the answer is in what's getting returned back to you with the method you're using. I don't think it's the name at all. I hope that helps.