RedisGraph / redisgraph-py

RedisGraph python client
https://redisgraph.io
BSD 3-Clause "New" or "Revised" License
189 stars 49 forks source link

Unknown command GRAPH.RO_QUERY #123

Closed GnaneshKunal closed 3 years ago

GnaneshKunal commented 3 years ago

The read only command GRAPH.RO_QUERY is not supported in older versions of redisgraph. Using redisgraph 2.0.0

from redisgraph import Graph

import redis

if __name__ == '__main__':
    r = redis.Redis()

    graph = Graph('social', r)

    result = graph.query('MATCH (n)-[t]->(m) RETURN (n), t, m')

    print(result.result_set)

logs:

-> graph = Graph('social', r)
(Pdb) c
Traceback (most recent call last):
  File "/home/gnanesh/work/redisgraph-py/redisgraph/graph.py", line 63, in get_label
    label = self._labels[idx]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/gnanesh/work/redisgraph-py/te.py", line 11, in <module>
    result = graph.query('MATCH (n) RETURN (n)')
  File "/home/gnanesh/work/redisgraph-py/redisgraph/graph.py", line 180, in query
    raise e
  File "/home/gnanesh/work/redisgraph-py/redisgraph/graph.py", line 176, in query
    return QueryResult(self, response)
  File "/home/gnanesh/work/redisgraph-py/redisgraph/query_result.py", line 62, in __init__
    self.parse_results(response)
  File "/home/gnanesh/work/redisgraph-py/redisgraph/query_result.py", line 84, in parse_results
    self.result_set = self.parse_records(raw_result_set)
  File "/home/gnanesh/work/redisgraph-py/redisgraph/query_result.py", line 113, in parse_records
    record.append(self.parse_node(cell))
  File "/home/gnanesh/work/redisgraph-py/redisgraph/query_result.py", line 148, in parse_node
    label = self.graph.get_label(cell[1][0])
  File "/home/gnanesh/work/redisgraph-py/redisgraph/graph.py", line 66, in get_label
    self._refresh_labels()
  File "/home/gnanesh/work/redisgraph-py/redisgraph/graph.py", line 38, in _refresh_labels
    lbls = self.labels()
  File "/home/gnanesh/work/redisgraph-py/redisgraph/graph.py", line 232, in labels
    return self.call_procedure("db.labels", read_only=True).result_set
  File "/home/gnanesh/work/redisgraph-py/redisgraph/graph.py", line 229, in call_procedure
    return self.query(q, read_only=read_only)
  File "/home/gnanesh/work/redisgraph-py/redisgraph/graph.py", line 180, in query
    raise e
  File "/home/gnanesh/work/redisgraph-py/redisgraph/graph.py", line 175, in query
    response = self.redis_con.execute_command(*command)
  File "/home/gnanesh/.local/lib/python3.10/site-packages/redis/client.py", line 901, in execute_command
    return self.parse_response(conn, command_name, **options)
  File "/home/gnanesh/.local/lib/python3.10/site-packages/redis/client.py", line 915, in parse_response
    response = connection.read_response()
  File "/home/gnanesh/.local/lib/python3.10/site-packages/redis/connection.py", line 756, in read_response
    raise response
redis.exceptions.ResponseError: unknown command `GRAPH.RO_QUERY`, with args beginning with: `social`, `CALL db.labels()`, `--compact`, 
gkorland commented 3 years ago

@GnaneshKunal you're right it's not supported in RedisGraph 2.0. What is the question?

GnaneshKunal commented 3 years ago

@GnaneshKunal you're right it's not supported in RedisGraph 2.0. What is the question?

The library is not usable for versions of redisgraph that doesn't have GRAPH.RO_QUERY command.