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
5 changes: 5 additions & 0 deletions redisgraph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ 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):
# `GRAPH.RO_QUERY` is unavailable in older versions.
command[0] = "GRAPH.QUERY"
response = self.redis_con.execute_command(*command)
return QueryResult(self, response)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check to see if read_only is True if so
recall 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