title: Efficiency of reopening sqlite database after each query
body: <p>I currently am working on a web server in tornado, but am having issues with different bits of code trying to access the database at once.</p>
  
  <p>I have simplified this by simply having a query function which basically does this (but slightly more advanced):</p>
  
  <pre><code>def query(command, arguments = []):
      db = sqlite3.open("models/data.db")
      cursor = db.cursor()
      cursor.execute(command, arguments)
      result = cursor.findall()
      db.close()
      return result
  </code></pre>
  
  <p>I'm just wondering how efficient it is to reopen the database after every query (I would guess it is a very large constant time operation, or would it cache things or something?), and whether there's a better way to do this.</p>