From 2c1caa96fcdc3aabbceb8e3fb2689a92f4d24755 Mon Sep 17 00:00:00 2001 From: mkmoisen Date: Thu, 28 Apr 2016 11:22:27 -0700 Subject: [PATCH] Convert str values to unicode in fetchone In Python2.7, fetchone() returns a row containing string, not unicode, values. This causes an error in my Flask application's templating system. I'm not sure if this would be better handled in the downstream library --- pyhs2/cursor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyhs2/cursor.py b/pyhs2/cursor.py index 32dc76a..9d7ff8d 100644 --- a/pyhs2/cursor.py +++ b/pyhs2/cursor.py @@ -138,7 +138,7 @@ def fetchone(self): # return the first record self._cursorLock.release() - return self._currentBlock[0] + return [val.decode('utf-8') if isinstance(val, str) else val for val in self._currentBlock[0]] def fetchmany(self,size=-1): """ return a sequential set of records. This is guaranteed by locking,