title: Connect to sqlite3.Connection using sqlalchemy
body: <p>I am using a library that creates an SQLite library in-memory by calling <code>sqlite3.connect(':memory:')</code>. I would like to connect to this database using <code>sqlalchemy</code> to use some ORM and other nice bells and whistles. Is there, in the depths of SQLAlchemy's API, a way to pass the resulting <code>sqlite3.Connection</code> object through so that I can re-use it?</p>
  
  <p>I cannot just re-connect with <code>connection = sqlalchemy.create_engine('sqlite:///:memory:').connect()</code> – as the <a href="https://sqlite.org/lang_createtable.html" rel="nofollow noreferrer">SQLite documentation</a> states: “The database ceases to exist as soon as the database connection is closed. Every :memory: database is distinct from every other. So, opening two database connections each with the filename ":memory:" will create two independent in-memory databases.” (Which makes sense. I also tried it, and the behaviour is as expected.)</p>
  
  <p>I have tried to follow SQLAlchemy's source code to find the low level location where the database connection is established and SQLite is actually called, but so far I found nothing. It looks like SQLAlchemy uses far too much obscure alchemy to do that for me to understand when and where it happens.</p>