Skip to content

IndexError: redis_graph.commit() #40

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

Closed
andreaBelmont opened this issue Jun 10, 2019 · 4 comments
Closed

IndexError: redis_graph.commit() #40

andreaBelmont opened this issue Jun 10, 2019 · 4 comments
Labels

Comments

@andreaBelmont
Copy link

Running this code

import redis
import redisgraph
print(redis.__version__)
from redisgraph import Node, Edge, Graph
r = redis.Redis(host='localhost', port=6379)
redis_graph = Graph('social', r)
john = Node(label='person', properties={'name': 'John Doe', 'age': 33, 'gender': 'male', 'status': 'single'})
redis_graph.add_node(john)
japan = Node(label='country', properties={'name': 'Japan'})
redis_graph.add_node(japan)
redis_graph.commit()

raises:

3.2.1
Traceback (most recent call last):
  File "./test.py", line 11, in <module>
    redis_graph.commit()
  File "/Users/acortis/my_codes/testbed/redisgraph/.env/lib/python3.7/site-packages/redisgraph/client.py", line 136, in commit
    return self.query(query)
  File "/Users/acortis/my_codes/testbed/redisgraph/.env/lib/python3.7/site-packages/redisgraph/client.py", line 158, in query
    statistics = response[1]
IndexError: list index out of range

redis-cli monitor shows

redis-cli monitor
OK

1560173120.370804 [0 [::1]:58173] "GRAPH.QUERY" "social" "CREATE (rhevungnwv:person{name:\"John Doe\",age:33,gender:\"male\",status:\"single\"}),(wtqgmdvmfi:country{name:\"Japan\"})"

The redisgraph.so library was built successfully from commit:

commit 728080f8d6bf72dc12fd90a98f741dbb0f04b74b (HEAD -> master, origin/master, origin/HEAD)

Could you please help?

Thanks

Andrea

@swilly22
Copy link
Contributor

Please install redisgraph-py directly from git:
pip install git+https://github.com/RedisGraph/redisgraph-py.git

RedisGraph 2.0 (728080f8d6bf72dc12fd90a98f741dbb0f04b74b)
is yet to be officially released, it introduces a change to the result-set structure which isn't compatible with RedisGraph-py 1.7

@andreaBelmont
Copy link
Author

Thank you this issue is resolved

@gustavodemorais
Copy link

gustavodemorais commented Jun 27, 2019

For the ones using Docker Images for Redis the same problem will appear if you're using the latest image redislabs/redisgraph

To comply with redisgraph-py:1.7, you should use redislabs/redisgraph:1.2.2.

@tsrancsik
Copy link

Hey, This issue is still there. @swilly22 's solution solves the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants