AttributeError error of the fetchone function of the DictCursor class
Cooh12 opened this issue · comments
Hello! In version 0.2.2, the fetchone function raised an AttributeError error when row == None. In version 0.2.3, when row == None, {} is returned.
I would like to know the reason for this change. After the update, the logic in my application broke down.
Thank you in advance.
class DictCursor(Cursor):
async def fetchone(self):
row = await super(DictCursor, self).fetchone()
if self._columns and row:
return dict(zip(self._columns, row))
else:
raise AttributeError("Not fould valid columns")
async def fetchone(self):
row = await super(DictCursor, self).fetchone()
if self._columns:
return dict(zip(self._columns, row)) if row else {}
else:
raise AttributeError("Invalid columns.")