is assembled into a first_connect/connect pool listener by the
connection strategy if non-None. Provides a simpler interface
+ - StaticPool now initializes, disposes and recreates without
+ opening a new connection - the connection is only opened when
+ first requested. dispose() also works on AssertionPool now.
- Added the ability to strip schema information when using
"tometadata" by passing "schema=None" as an argument. If schema
- def __init__(self, creator, **params):
- Construct a StaticPool.
- :param creator: a callable function that returns a DB-API
- connection object. The function will be called with
- :param echo: If True, connections being pulled and retrieved
- from the pool will be logged to the standard output, as well
- as pool sizing information. Echoing can also be achieved by
- enabling logging for the "sqlalchemy.pool"
- namespace. Defaults to False.
- :param reset_on_return: If true, reset the database state of
- connections returned to the pool. This is typically a
- ROLLBACK to release locks and transaction resources.
- Disable at your own peril. Defaults to True.
- :param listeners: A list of
- :class:`~sqlalchemy.interfaces.PoolListener`-like objects or
- dictionaries of callables that receive events when DB-API
- connections are created, checked out and checked in to the
- Pool.__init__(self, creator, **params)
+ if '_conn' in self.__dict__:
self._checked_out = False
+ def test_no_connect_on_recreate(self):
+ raise Exception("no creates allowed")
+ for cls in (pool.SingletonThreadPool, pool.StaticPool,
+ pool.QueuePool, pool.NullPool, pool.AssertionPool):
+ p = cls(creator=creator)
+ mock_dbapi = MockDBAPI()
+ p = cls(creator=mock_dbapi.connect)
+ mock_dbapi.throw_error = True