RedisGraph/redisgraph-py

ResponseError: unknown command 'GRAPH.QUERY'

debadityamandal opened this issue · 5 comments

I was executing redis_graph.commit().I got following error-
ResponseError Traceback (most recent call last)
in
5 edge=Edge(john,"visited",japan,properties={"name":"pleasure"})
6 redis_graph.add_edge(edge)
----> 7 redis_graph.commit()

~/.local/lib/python3.6/site-packages/redisgraph/graph.py in commit(self)
94 query = query[:-1]
95
---> 96 return self.query(query)
97
98 def flush(self):

~/.local/lib/python3.6/site-packages/redisgraph/graph.py in query(self, q, params)
128 result_set = None
129
--> 130 response = self.redis_con.execute_command("GRAPH.QUERY", self.name, q, "--compact")
131 return QueryResult(self, response)
132

~/.local/lib/python3.6/site-packages/redis/client.py in execute_command(self, *args, **options)
666 try:
667 connection.send_command(*args)
--> 668 return self.parse_response(connection, command_name, **options)
669 except (ConnectionError, TimeoutError) as e:
670 connection.disconnect()

~/.local/lib/python3.6/site-packages/redis/client.py in parse_response(self, connection, command_name, **options)
678 def parse_response(self, connection, command_name, **options):
679 "Parses a response from the Redis server"
--> 680 response = connection.read_response()
681 if command_name in self.response_callbacks:
682 return self.response_callbacks[command_name](response, **options)

~/.local/lib/python3.6/site-packages/redis/connection.py in read_response(self)
627 raise
628 if isinstance(response, ResponseError):
--> 629 raise response
630 return response
631

ResponseError: unknown command 'GRAPH.QUERY'

@debadityamandal it usually indicates the the RedisGraph module wasn't loaded.
How did you run the redis-server?

Please make sure redis-server has been loaded with the RedisGraph module.
See docs

@gkorland I started the redis-server by executing following command-
sudo systemctl restart redis.service
I was using following instructions in python
r=redis.Redis()
redis_graph=Graph("Social",r)

@debadityamandal you should edit the redis.conf first and give it the path redisgraph so file.

sudo vi  /etc/redis/redis.conf

After you open file look for the MODULES section. And uncomment loadmodule

loadmodule /path/to/redisgraph.so

Thank you all for helping me