title: What is the point of `cursor` class in psycopg?
body: <p>I would like to modify some data with INSERTs and UPDATEs. From the psycopg tutorials it looks like I need</p>
  
  <pre><code>cur = connection.cursor()
  cur.execute(my_insert_statement)
  connection.commit()
  </code></pre>
  
  <p>Psycopg's <a href="http://initd.org/psycopg/docs/cursor.html">cursor class</a> seems to have little to do with the cursors, as defined by <a href="http://www.postgresql.org/docs/9.3/static/plpgsql-cursors.html">postgres</a>.</p>
  
  <p>If I modularize my script, creating a connection in the main module and some worker functions (no threading, just for modularization) should I</p>
  
  <ol>
  <li><p>pass the connection parameter to the functions and recreate cursor every time. Is there significant overhead creating new cursor object frequently?</p>
  
  <pre><code>def process_log_file(self, connection):
  </code></pre></li>
  <li><p>pass both connection and cursor - makes function signatures and implementation needlessly complicated</p>
  
  <pre><code>def process_log_file(self, connection, cursor):
  </code></pre></li>
  <li><p>pass only cursor as parameter and use <code>mycursor.connection.commit()</code> for commiting</p>
  
  <pre><code>def process_log_file(self, cursor):
  </code></pre></li>
  </ol>