title: Sqlite. How to get value of Auto Increment Primary Key after Insert, other than last_insert_rowid()?
body: <p>I am using Sqlite3 with Flask microframework, but this question concerns only the Sqlite side of things..</p>
  
  <p>Here is a snippet of the code:</p>
  
  <pre><code>g.db.execute('INSERT INTO downloads (name, owner, mimetype) VALUES (?, ?, ?)', [name, owner, mimetype])
  file_entry = query_db('SELECT last_insert_rowid()')
  g.db.commit()
  </code></pre>
  
  <p>The <code>downloads</code> table has another column with the following attributes:  <code>id integer primary key autoincrement,</code></p>
  
  <p>If two people write at the same time the code above could produce errors.</p>
  
  <p>Transactions can be messy. In Sqlite is there a neat built in way of returning the primary key generated after doing an INSERT ?</p>