# SQLAlchemy 0.4 Documentation

Multiple Pages | One Page
Version: 0.4.6 Last Updated: 05/14/08 14:36:43

### module sqlalchemy.engine.strategies

Strategies for creating new instances of Engine types.

These are semi-private implementation classes which provide the underlying behavior for the "strategy" keyword argument available on create_engine(). Current available options are `plain`, `threadlocal`, and `mock`.

New strategies can be added via new `EngineStrategy` classes.

### class DefaultEngineStrategy(EngineStrategy)

Base class for built-in stratgies.

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

### class EngineStrategy(object)

An adaptor that processes input arguements and produces an Engine.

Provides a `create` method that receives input arguments and produces an instance of 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 Engine instance.

back to section top

### class MockEngineStrategy(EngineStrategy)

Strategy for configuring an Engine-like object with mocked execution.

Produces a single mock Connectable object which dispatches statement execution 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)

Strategy for configuring a regular Engine.

def __init__(self)

Construct a new `PlainEngineStrategy`.

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

### class ThreadLocalEngineStrategy(DefaultEngineStrategy)

Strategy for configuring an Engine with thredlocal behavior.

def __init__(self)

Construct a new `ThreadLocalEngineStrategy`.

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