-
Notifications
You must be signed in to change notification settings - Fork 49
update internal cached mapping upon graph version change #94
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #94 +/- ##
==========================================
+ Coverage 84.98% 85.24% +0.25%
==========================================
Files 8 9 +1
Lines 586 664 +78
==========================================
+ Hits 498 566 +68
- Misses 88 98 +10
Continue to review full report at Codecov.
|
redisgraph/query_result.py
Outdated
if(graph.version != self.graph_version): | ||
# graph version miss-match, this is an indication that | ||
# the graph schema was modified, sync it. | ||
graph.version = self.graph_version | ||
graph._refresh_schema() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that refresh schema should return the timestamp retrieved from the last procedure reply. The schema can be changed between two procedure calls but you will update only according to the latest procedure reply.
if(graph.version != self.graph_version): | |
# graph version miss-match, this is an indication that | |
# the graph schema was modified, sync it. | |
graph.version = self.graph_version | |
graph._refresh_schema() | |
graph_version = self.graph_version | |
while(graph.version != graph_version): | |
# graph version miss-match, this is an indication that | |
# the graph schema was modified, sync it. | |
graph.version = graph_version | |
graph_version = graph._refresh_schema() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
taking your comment to the extreme I think that the mapping used in the original compact reply can become obsolete by the time the first procedure call is made, although the client cache might be in sync with the server the mapping between the current result-set and the cache might be complete incorrect, in which case I suggest reissuing the query
# construct query command | ||
# ask for compact result-set format | ||
# specify known version | ||
command = ["GRAPH.QUERY", self.name, query, "--compact", "version", self.version] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use version
only when server supports this feature, for older version of RedisGraph this will trigger arity error
# 1. introduce relationship-type 'R' | ||
# 2. introduce label 'L' | ||
# 3. introduce attribute 'x' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see logic below
a3957f6
to
535524f
Compare
return QueryResult(self, response) | ||
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for now, this is ok
if we introduce new flags there should be a module version check, so each flag is verified with its version and the query will not run if we have a version mismatch
No description provided.