Skip to content

Fall back to GRAPH.QUERY when GRAPH.RO_QUERY is not available. #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Call the same method by setting read_only to False
  • Loading branch information
GnaneshKunal committed May 6, 2021
commit f57ceb4c8b526de04a4d88b105a6d44d8ac6d7bb
6 changes: 2 additions & 4 deletions redisgraph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,9 @@ def query(self, q, params=None, timeout=None, read_only=False):
except redis.exceptions.ResponseError as e:
if "wrong number of arguments" in str(e):
print("Note: RedisGraph Python requires server version 2.2.8 or above")
if "unknown command" in str(e):
if "unknown command" in str(e) and read_only:
# `GRAPH.RO_QUERY` is unavailable in older versions.
command[0] = "GRAPH.QUERY"
response = self.redis_con.execute_command(*command)
return QueryResult(self, response)
return self.query(q, params, timeout, read_only=False)
raise e
except VersionMismatchException as e:
# client view over the graph schema is out of sync
Expand Down