Skip to content

Commit 3e84f57

Browse files
timesongswilly22
authored andcommitted
add bytes type decode process (#44)
1 parent bf7e43d commit 3e84f57

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

redisgraph/query_result.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,12 @@ def parse_scalar(self, cell):
143143
scalar = None
144144

145145
elif scalar_type == ResultSetScalarTypes.VALUE_STRING:
146-
scalar = str(value)
146+
if isinstance(value, bytes):
147+
scalar = value.decode()
148+
elif not isinstance(value, str):
149+
scalar = str(value)
150+
else:
151+
scalar = value
147152

148153
elif scalar_type == ResultSetScalarTypes.VALUE_INTEGER:
149154
scalar = int(value)

redisgraph/util.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ def quote_string(v):
1313
quote_string wraps given v with quotes incase
1414
v is a string.
1515
"""
16-
if not isinstance(v, str):
16+
17+
if isinstance(v, bytes):
18+
v = v.decode()
19+
elif not isinstance(v, str):
1720
return v
1821
if len(v) == 0:
1922
return '""'

0 commit comments

Comments
 (0)