with driver.session() as session: result = session.run("MATCH(n) RETURN n") return result
this result object is containing no data when tried to use in different function as an iterator but it works within same function. I am not sure if i am thinking or doing something wrong. please help me solve this
Hello @sandeepkrjha1999 and welcome to the Neo4j community
def bolt_to_list(result): """ Function to transform BOLT result into list of dictionnaries. """ return [r.data() for r in result]
So you can use this function like this:
with driver.session() as session: result = bolt_to_list(session.run("MATCH(n) RETURN n")) return result
even with this approach you are storing all results in a list at once in the memory, i don't want to do that, I want that i can use it as an iterator for accessing records one by one without storing it in any list.
Basically what i mean to say is I want to return the bolt type and then use it in some other function for accessing the records from the bolt iterator