Skip to content

Commit 4e2be1e

Browse files
authored
Fall back to GRAPH.QUERY when GRAPH.RO_QUERY is not available. (#124)
* `GRAPH.RO_QUERY` is unavailable in older versions. So fallback to GRAPH.QUERY when the command is not found. * Call the same method by setting read_only to `False`
1 parent e988cdd commit 4e2be1e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

redisgraph/graph.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ 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) and read_only:
181+
# `GRAPH.RO_QUERY` is unavailable in older versions.
182+
return self.query(q, params, timeout, read_only=False)
180183
raise e
181184
except VersionMismatchException as e:
182185
# client view over the graph schema is out of sync

0 commit comments

Comments
 (0)