Since this is a different issue I created a different thread. I am trying to set a numeric property value of a node using the python module for RedisGraph.
Using this example code:
params = {'purpose':"pleasure"}
query = """MATCH (p:person)-[v:visited {purpose:$purpose}]->(c:country)
RETURN p.name, p.age, v.purpose, c.name"""
result = redis_graph.query(query, params)
I am able to make my own query with parameters and run it successfully:
params = {'balance': 1000.4}
query = """MERGE (p:person) SET p.balance = $balance"""
result = redis_graph.query(query, params)
Result:
Properties set 1.0
internal execution time 0.3287
However, when the value is negative I get an error:
params = {'balance': -1000.4}
query = """MERGE (p:person) SET p.balance = $balance"""
result = redis_graph.query(query, params)
Result:
---------------------------------------------------------------------------
ResponseError Traceback (most recent call last)
<ipython-input-117-974393b67c61> in <module>
3 query = """MERGE (p:person) SET p.balance = $balance"""
4
----> 5 result = redis_graph.query(query, params)
6
7 # Print resultset
~\AppData\Local\Programs\Python\Python37-32\lib\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
~\AppData\Local\Programs\Python\Python37-32\lib\site-packages\redis\client.py in execute_command(self, *args, **options)
899 try:
900 conn.send_command(*args)
--> 901 return self.parse_response(conn, command_name, **options)
902 except (ConnectionError, TimeoutError) as e:
903 conn.disconnect()
~\AppData\Local\Programs\Python\Python37-32\lib\site-packages\redis\client.py in parse_response(self, connection, command_name, **options)
913 "Parses a response from the Redis server"
914 try:
--> 915 response = connection.read_response()
916 except ResponseError:
917 if EMPTY_RESPONSE in options:
~\AppData\Local\Programs\Python\Python37-32\lib\site-packages\redis\connection.py in read_response(self)
754
755 if isinstance(response, ResponseError):
--> 756 raise response
757 return response
758
ResponseError: errMsg: Invalid input 'b': expected ';', a statement option, a query hint, a clause or a schema command line: 1, column: 1, offset: 0 errCtx: balance=-1000.4 MERGE (p:person) SET p.balance = $balance errCtxOffset: 0
It makes no difference if I use integers or floats. Using strings doesn’t produce an error as expected.