title: Python does cursor execute load all data
body: <p>I am trying to query a large data (10 million rows) and try to prevent out of memory, but not familiar with Python and confused with different opinions regarding the execute(), cursor iterator and fetchone()</p>
  
  <p>Am I right to assume that cursor.execute() does not load all data into memory and only when I call fetchone() then it will load 1 row of data</p>
  
  <pre><code>from mysql.connector import MySQLConnection
  
  
  def query():
      conn = MySQLConnection(host=conf['host'],
                                  conf['port'],
                                  conf['user'],
                                  conf['password'],
                                  conf['database'])
      cursor = conn.cursor(buffered=True)
      cursor.execute('SELECT * FROM TABLE') # 10 million rows
  </code></pre>
  
  <p>does this cursor iterator does the same with fetchone() ?</p>
  
  <pre><code>for row in cursor:
      print(row)
  </code></pre>
  
  <p>is my code snippet is safe to handle 10 million rows of data? if not, how can I safely iterate the data without out of memory?</p>