title: Python - How to loop a ResultSet
body: <p>I'm working with Python and JayDeBeApi to connect to a Oracle-type database.</p>
  
  <p>In the SELECT's statements I need to get about 10+ thousand of records.</p>
  
  <p>In the first time I done by using the "fetchAll()" method, but this loads my memory and I wouldn't like to this to happen.</p>
  
  <p>I get the cursor by using the code below:</p>
  
  <pre><code>def do_select(sql, db_conn):
      resultSet = None
      try:
          cursor = db_conn.cursor()
          cursor.execute(sql)
  
          resultSet = {
              "cursor": cursor,
              "columns": cursor.description
          }
  
      except Exception as error:
          print("An error occurred" + str(error))
  
      return resultSet
  </code></pre>
  
  <p>And <strong>instead of</strong> using this type of code:</p>
  
  <pre><code>resultSet = self.do_select(sql, self.get_db_conn())
  rows = resultSet["cursor"].fetchAll()
  for row in rows:
     # Do something...
  </code></pre>
  
  <p>I would like to do something like this:</p>
  
  <pre><code>resultSet = self.do_select(sql, self.get_db_conn())
  while resultSet.next():
     entire_row_tuple = resultSet.getCurrent() #I don't know if this is possible in python
     #Do something with entire_row_tuple...
  </code></pre>
  
  <p>Is this possible in python? Or, does exists a better way instead of using "fetchAll()" method?</p>
  
  <p>Thank you</p>