Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added description attribute to cursor #43

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pyhs2/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down