title: How to open exactly one connection for SQLAlchemy engine?
body: <p>In my application, I create an instance of following class one time and I want to open exactly one connection for one instance of my application. I have tried changing the poolclass argument of the create_engine function to StaticPool or AssertionPool with no luck.</p>
  
  <p>SQLAlchemy always opens two connections per instance of my application and keeps one of the connection idle all the time.</p>
  
  <p>I have also tried arguments like pool_size = 1 and max_overflow = 0 for default QueuePool but I cannot restrict total connections to 1 connection. The <a href="http://docs.sqlalchemy.org/en/latest/core/pooling.html#sqlalchemy.pool.QueuePool" rel="nofollow noreferrer">documentation</a> states about total number of connections: "It follows then that the total number of simultaneous connections the pool will allow is pool_size + max_overflow, and the total number of “sleeping” connections the pool will allow is pool_size."</p>
  
  <p>I am using sqlalchemy 1.1.4 and python 2.7.</p>
  
  <p>Here is my code for the constructor of class I am creating engine:</p>
  
  <pre><code>class DBManager(object):
  
      def __init__(self, connection_string):
          try:
              self.engine = create_engine(
                  connection_string,
                  poolclass=StaticPool
                  )
          except NoSuchModuleError as module_error:
              logging.error( str( module_error ) )
              raise
          except OperationalError as oper_error:
              logging.error( str( oper_error ) )
              raise
  </code></pre>
  
  <p><strong>EDIT:</strong>
  I do not want to use NullPool because I do not want to recreate database connection for every transaction. I want exactly one connection open at all times.</p>
  
  <p>Can somebody please tell what am I doing wrong?
  Thanks</p>