title: How to retrieve inserted id after inserting row in SQLite using Python?
body: <p>How to retrieve inserted id after inserting row in SQLite using Python? I have table like this:</p>
  
  <pre><code>id INT AUTOINCREMENT PRIMARY KEY,
  username VARCHAR(50),
  password VARCHAR(50)
  </code></pre>
  
  <p>I insert a new row with example data <code>username="test"</code> and <code>password="test"</code>. How do I retrieve the generated id in a transaction safe way? This is for a website solution, where two people may be inserting data at the same time. I know I can get the last read row, but I don't think that is transaction safe. Can somebody give me some advice?</p>