Skip to content

Commit 060bbdd

Browse files
committed
GRAPH.RO_QUERY is unavailable in older versions. So fallback to
GRAPH.QUERY when the command is not found.
1 parent e988cdd commit 060bbdd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

redisgraph/graph.py

+5
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ def query(self, q, params=None, timeout=None, read_only=False):
177177
except redis.exceptions.ResponseError as e:
178178
if "wrong number of arguments" in str(e):
179179
print("Note: RedisGraph Python requires server version 2.2.8 or above")
180+
if "unknown command" in str(e):
181+
# `GRAPH.RO_QUERY` is unavailable in older versions.
182+
command[0] = "GRAPH.QUERY"
183+
response = self.redis_con.execute_command(*command)
184+
return QueryResult(self, response)
180185
raise e
181186
except VersionMismatchException as e:
182187
# client view over the graph schema is out of sync

0 commit comments

Comments
 (0)