Guest User

Untitled

a guest
Jul 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. def execute(self, query):
  2. """Executes a query, returning an iterator of resulting rows."""
  3. cursor = self._connection.cursor(convert=False)
  4. cursor.execute(query)
  5. if cursor.description:
  6. #column_names = [column[0] for column in cursor.description]
  7. #for row in cursor:
  8. # yield row
  9. while True:
  10. chunk = cursor.fetchmany(256)
  11. if chunk:
  12. yield chunk
  13. else:
  14. return
Add Comment
Please, Sign In to add comment