Fetch a 'return'd value from an executemany statement
<p>Using Postgresql 9.5 with psycopg2.</p>

<p>Using 'returning', I can retrieve the 'id' of a single row I insert.</p>

<pre><code>sql = "insert into %s (%s) values (%s) returning id" % (table_name, columns, values_template)        
values = tuple(row_dict[key] for key in keys)
cur.execute(sql, values)
id_new_row = cur.fetchone()[0]
</code></pre>

<p>I was hoping to also retrieve the id of the last of many rows inserted using the <code>executemany</code> statement.</p>

<pre><code>cur.executemany(insert_sql , data_dict)
#get id of the last row inserted
id_new_row = cur.fetchone()[0]
</code></pre>

<p>But this throws a DatabaseError,  "no results to fetch".   </p>

<p>Is this just a fundamentally impossible thing to do,  or am I not calling for the result correctly?</p>