Module neug.query_result
The Neug result module.
QueryResult Objects
class QueryResult(object)QueryResult represents the result of a cypher query. Could be visited as a iterator.
It has the following methods to iterate over the results.
- hasNext(): Returns True if there are more results to iterate over.
- getNext(): Returns the next result as a list.
- length(): Returns the total number of results.
- column_names(): Returns the projected column names as strings.
>>> from neug import Database
>>> db = Database("/tmp/test.db", mode="r")
>>> conn = db.connect()
>>> result = conn.execute('MATCH (n) RETURN n')
>>> for row in result:
>>> print(row)
__init__
def __init__(result)Initialize the QueryResult.
- Parameters:
result(PyQueryResult) The result of the query, returned by the query engine. It is a C++ object and is exported to python via pybind.
column_names
def column_names()Return the projected column names as a list of strings.
get_bolt_response
def get_bolt_response() -> strGet the result in Bolt response format. TODO(zhanglei,xiaoli): Make sure the format consistency with neo4j bolt response.
- Returns:
- str The result in Bolt response format.