cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How to get back data without knowing the KEY?

lingvisa
Graph Fellow
def _query_by_cypher(tx, query):
        print('{}'.format(query))
        results = tx.run(query)

Let's say I want a function to accept users' any cypher string as arguments, and return results. I know normally in order to access data from the "resutls" variable, I need to know some key so that I can do:
[record['count'] for record in results]

But in this case, I have no idea of any possible 'key' that may be used in the 'RETURN ... AS ...' pattern. Is there still a way to get back the data from the results variable without knowing any details of the cypher query beforehand?

1 REPLY 1

Hello @lingvisa

You can use index (0, 1, 2, etc.) if you don't know the keys.

results[0]

Regards,
Cobra