diff --git a/redisgraph/client.py b/redisgraph/client.py index e3e9524..a8d9354 100644 --- a/redisgraph/client.py +++ b/redisgraph/client.py @@ -1,14 +1,14 @@ import random import string -from query_result import QueryResult +from .query_result import QueryResult def random_string(length=10): """ Returns a random N chracter long string. """ - return ''.join(random.choice(string.lowercase) for x in range(length)) + return ''.join(random.choice(string.ascii_lowercase) for x in range(length)) class Node(object): @@ -28,7 +28,7 @@ def __str__(self): return '({alias}:{label} {{{properties}}})'.format( alias=self.alias, label=self.label, - properties=','.join(key+':'+str(val) for key, val in self.properties.iteritems())) + properties=','.join(key+':'+str(val) for key, val in self.properties.items())) class Edge(object): @@ -51,7 +51,7 @@ def __str__(self): return '({src_alias})-[:{relation} {{{properties}}}]->({dest_alias})'.format( src_alias=self.src_node.alias, relation=self.relation, - properties=','.join(key+':'+str(val) for key, val in self.properties.iteritems()), + properties=','.join(key+':'+str(val) for key, val in self.properties.items()), dest_alias=self.dest_node.alias) else: return '({src_alias})-[:{relation}]->({dest_alias})'.format( @@ -97,7 +97,7 @@ def commit(self): """ query = 'CREATE ' - for _, node in self.nodes.iteritems(): + for _, node in self.nodes.items(): query += str(node) + ',' for edge in self.edges: diff --git a/redisgraph/query_result.py b/redisgraph/query_result.py index c8d9816..3c5183c 100644 --- a/redisgraph/query_result.py +++ b/redisgraph/query_result.py @@ -46,6 +46,7 @@ def _retrieve_data_from_statistics(self, statistics): @staticmethod def _get_value(prop, statistics): for stat in statistics: + stat = stat.decode() if prop in stat: return float(stat.split(': ')[1].split(' ')[0])