SQLAlchemy 0.4 Documentation

Multiple Pages | One Page
Version: 0.4 Last Updated: 08/12/07 12:43:00

module sqlalchemy.engine.strategies

Define different strategies for creating new instances of sql.Engine.

By default there are two, one which is the "thread-local" strategy, one which is the "plain" strategy.

New strategies can be added via constructing a new EngineStrategy object which will add itself to the list of available strategies.

class DefaultEngineStrategy(EngineStrategy)

def create(self, name_or_url, **kwargs)
def get_engine_cls(self)
def pool_threadlocal(self)
back to section top

class EngineStrategy(object)

Define a function that receives input arguments and produces an instance of sql.Engine, typically an instance sqlalchemy.engine.base.Engine or a subclass.

def __init__(self, name)

Construct a new EngineStrategy object.

Sets it in the list of available strategies under this name.

def create(self, *args, **kwargs)

Given arguments, returns a new sql.Engine instance.

back to section top

class MockEngineStrategy(EngineStrategy)

Produces a single Connection object which dispatches statement executions to a passed-in function

def __init__(self)

Construct a new MockEngineStrategy.

def create(self, name_or_url, executor, **kwargs)
back to section top

class PlainEngineStrategy(DefaultEngineStrategy)

def __init__(self)

Construct a new PlainEngineStrategy.

def get_engine_cls(self)
def pool_threadlocal(self)
back to section top

class ThreadLocalEngineStrategy(DefaultEngineStrategy)

def __init__(self)

Construct a new ThreadLocalEngineStrategy.

def get_engine_cls(self)
def pool_threadlocal(self)
back to section top
Up: API Documentation | Previous: module sqlalchemy.engine.url | Next: module sqlalchemy.engine.default