From 41b914c82c04d80e5d5c500bf3b5ab26e1ad22d1 Mon Sep 17 00:00:00 2001 From: pilipolio Date: Tue, 28 Apr 2015 12:40:43 +0100 Subject: [PATCH] Added description attribute to cursor Following https://www.python.org/dev/peps/pep-0249/#description --- pyhs2/cursor.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyhs2/cursor.py b/pyhs2/cursor.py index 32dc76a..f124b94 100644 --- a/pyhs2/cursor.py +++ b/pyhs2/cursor.py @@ -49,11 +49,13 @@ class Cursor(object): _standbyBlock = None _blockRequestInProgress = False _cursorLock = None + description = None def __init__(self, _client, sessionHandle): self.session = sessionHandle self.client = _client self._cursorLock = threading.RLock() + self.description = [] def execute(self, hql): self.hasMoreRows = True @@ -62,7 +64,11 @@ def execute(self, hql): self.operationHandle = res.operationHandle if res.status.errorCode is not None: raise Pyhs2Exception(res.status.errorCode, res.status.errorMessage) - + + cols = self.getSchema() + if cols is not None: + self.description = [(col['columnName'], col['type'], None, None, None, None, None) for col in cols] + def fetch(self): rows = [] while self.hasMoreRows: