title: Select and update in same transaction with python sqlite
body: <p>I would like to do one transaction with a select and an update query on the same sqlite3 database with Python, to make sure no other thread can make a select while I have not done the update query with the first thread.</p>
  
  <p>The base is very simple, kind of a queue of jobs to do, and I want to make sure multiple thread can't get the same job id.</p>
  
  <pre><code>with sqlite3.connect('database.sqlite') as db:
      db_cursor = db.cursor()
      db_cursor.execute("SELECT id FROM mytable WHERE status=?", 'todo')
      myrow = db_cursor.fetchone()
      if myrow :
          id = myrow[0]
          db_cursor.execute("UPDATE mytable SET status=? WHERE id=?", ['done', id])
          # id is used after that.
  </code></pre>
  
  <p>Would the isolation-level parameter be a solution? Does the isolation work while I have released the connection, or only up to the "fetchone" function?</p>
  
  <p>Thanks.</p>