diff --git a/redisgraph/graph.py b/redisgraph/graph.py index a12fe7f..9dc5c4a 100644 --- a/redisgraph/graph.py +++ b/redisgraph/graph.py @@ -162,15 +162,25 @@ def _build_params_header(self, params): # Header starts with "CYPHER" params_header = "CYPHER " for key, value in params.items(): - # If value is string add quotation marks. - if isinstance(value, str): - value = quote_string(value) - # Value is None, replace with "null" string. - elif value is None: - value = "null" - params_header += str(key) + "=" + str(value) + " " + params_header += str(key) + "=" + str(self._parse_value(value)) + " " return params_header + def _parse_value(self, value): + # If value is string add quotation marks. + if isinstance(value, str): + value = quote_string(value) + # If value is dictionary, need to remove quotation mark + elif isinstance(value, dict): + temp_value = "{" + for key, val in value.items(): + temp_value += str(key) + ":" + str(val) + "," + value = temp_value[:-1] + "}" + # Value is None, replace with "null" string. + elif value is None: + value = "null" + + return value + def query(self, q, params=None, timeout=None, read_only=False): """ Executes a query against the graph.