I have a requirement to connect to hive server and load the data into teradata but I am facing the below error
Code snippet
from __future__ import generators
import numpy as np
import pandas
def ResultIterator(cursor, arraysize=1000😞
'iterator using fetchmany and consumes less memory'
while True:
results = cursor.fetchmany(arraysize)
if not results:
break
for result in results:
yield result
conn = pyodbc.connect('DSN=AzureProdDDEP',autocommit=True)
curs = conn.cursor()
curs.execute(sql)
data = []
for result in ResultIterator(curs😞
data.append(result)
But getting the below error
--------------------------------------------------------------------------- Error Traceback (most recent call last) <ipython-input-14-bfdfc82db1c5> in <module> 5 data = [] 6 ----> 7 for result in ResultIterator(curs): 8 data.append(result) 9 <ipython-input-11-d227f5c5bd31> in ResultIterator(cursor, arraysize) 8 'iterator using fetchmany and consumes less memory' 9 while True: ---> 10 results = cursor.fetchmany(arraysize) 11 12 if not results: Error: ('HY000', "[HY000] [Hortonworks][Hardy] (35) Error from server: error code: '0' error message: 'Invalid OperationHandle: OperationHandle [opType=EXECUTE_STATEMENT, getHandleIdentifier()=4e9ad9dd-6580-47bb-9f87-8a7721320962]'. (35) (SQLFetch)")