adding cursor.description and cursor.fetchmany()
Opened this issue · 1 comments
WilliamStam commented
i added a PR to patch this in #25 but incase somone lands up here and PR isnt accepted or delayed then a "sneaky" fix would be to do something like this:
class Cursor():
def __init__(self, baseObject):
self.__class__ = type(baseObject.__class__.__name__,(self.__class__, baseObject.__class__),{})
self.__dict__ = baseObject.__dict__
@property
def description(self):
return self._cursor.description
async def fetchmany(self, *args, **kwargs):
return await self._loop.run_in_executor(self._thread_pool, self._cursor.fetchmany, *args, **kwargs)
and usage would be something like
conn = await self.connection.acquire()
self.cursor = Cursor(await conn.cursor())
(its less than ideal but hey... cowboy thursdays right!)
another issue for description: #19
WilliamStam commented
came across a use case that i need to set the outputtypehandler
this works
def output_type_handler(cursor, name, default_type, size, precision, scale):
....
oracle_pool = await cx_Oracle_async.create_pool(...)
async with oracle_pool.acquire() as connection:
async with connection.cursor() as cursor:
cursor._cursor.outputtypehandler = output_type_handler