title: sharing a :memory: database between different threads in python using sqlite3 package
body: <p>I would like to create a :memory: database in python and access it from different threads.
  Essentially something like:</p>
  
  <pre><code>class T(threading.Thread):
      def run(self):
          self.conn = sqlite3.connect(':memory:')
          # do stuff with the database
  
  for i in xrange(N):
      T().start()
  </code></pre>
  
  <p>and have all the connections referring to the same database.</p>
  
  <p>I am aware of passing <code>check_same_thread=True</code> to the connect function and sharing the 
  connection between threads but would like to avoid doing that if possible. Thanks for any help.</p>
  
  <p>EDIT: corrected a typo. I originally said "have all the connections referring to the same thread" substituting thread for database. </p>