title: Returning a value with psycopg2
body: <p>Ideally I'd like to be able to do something like:</p>
  
  <pre><code>id_of_new_row = cursor.lastrowid()
  </code></pre>
  
  <p>in which I get the id of the newly created or modified row.  But this isn't available through psycopg2.  Alternatively, I've tried this:</p>
  
  <pre><code>id_of_new_row = cursor.execute('INSERT INTO this_table (value1, value2, value3) VALUES (%s, %s, %s) RETURNING id', (some_value1, some_value2, some_value3))
  </code></pre>
  
  <p>which doesn't work, probably because it won't know the id until after the commit is made...  </p>
  
  <p>Help!</p>