Closed andreaBelmont closed 5 years ago
Please see my answer to #40
mhmhm ... your answer to #40 did not solve the issue with the docker container. Now after installing the new redisgrap py I have this error:
Unknown column type.
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
~/my_codes/testbed/redisgraph/test.py in <module>
13 RETURN p.name, p.age, v.purpose, c.name"""
14
---> 15 result = redis_graph.query(query)
16
17 # Print resultset
~/my_codes/testbed/redisgraph/.env/lib/python3.7/site-packages/redisgraph/graph.py in query(self, q)
111 result_set = None
112 response = self.redis_con.execute_command("GRAPH.QUERY", self.name, q, "--compact")
--> 113 return QueryResult(self, response)
114
115 def _execution_plan_to_string(self, plan):
~/my_codes/testbed/redisgraph/.env/lib/python3.7/site-packages/redisgraph/query_result.py in __init__(self, graph, response)
34 self.parse_statistics(response[0])
35 else:
---> 36 self.parse_results(response)
37 self.parse_statistics(response[-1]) # Last element.
38
~/my_codes/testbed/redisgraph/.env/lib/python3.7/site-packages/redisgraph/query_result.py in parse_results(self, raw_result_set)
44 return
45
---> 46 self.result_set = self.parse_records(raw_result_set)
47
48 def parse_statistics(self, raw_statistics):
~/my_codes/testbed/redisgraph/.env/lib/python3.7/site-packages/redisgraph/query_result.py in parse_records(self, raw_result_set)
66 record = []
67 for idx, cell in enumerate(row):
---> 68 if self.header[idx][0] == ResultSetColumnTypes.COLUMN_SCALAR:
69 record.append(self.parse_scalar(cell))
70 elif self.header[idx][0] == ResultSetColumnTypes.COLUMN_NODE:
IndexError: list index out of range
For your information, updating the docker image to Redis 5.0.5 (00000000/0) 64 bit does not have any efffect on the error
Please pull the edge version of RedisGraph from dockerhub
docker run -p 6379:6379 -it --rm redislabs/redisgraph:edge
Still not quite there. This time the test file above does not raise any expections, however the result of pretty_print is not what is expected
In [2]: result.pretty_print()
internal execution time 0.431
the result-set is returning empty as the query is looking for a connection between a person and a country, but the graph been created doesn't contains any connections.
I've updated the test file:
import redis
import redisgraph
print(redis.__version__)
from redisgraph import Node, Edge, Graph
r = redis.Redis(host='localhost', port=6379)
redis_graph = Graph('social', r)
john = Node(label='person', properties={'name': 'John Doe', 'age': 33, 'gender': 'male', 'status': 'single'})
redis_graph.add_node(john)
japan = Node(label='country', properties={'name': 'Japan'})
redis_graph.add_node(japan)
edge = Edge(john, 'visited', japan, properties={'purpose': 'pleasure'})
redis_graph.add_edge(edge)
redis_graph.commit()
query = """MATCH (p:person)-[v:visited {purpose:"pleasure"}]->(c:country)
RETURN p.name, p.age, v.purpose, c.name"""
result = redis_graph.query(query)
# Print resultset
result.pretty_print()
python test.py
3.2.1
+----------+-------+-----------+--------+
| p.name | p.age | v.purpose | c.name |
+----------+-------+-----------+--------+
| John Doe | 33 | pleasure | Japan |
+----------+-------+-----------+--------+
internal execution time 0.2573
Running this code:
raises:
I am running redisgraph from docker