SQLAlchemy 0.4 Documentation - module sqlalchemy.engine.strategies

# SQLAlchemy 0.4 Documentation

Multiple Pages | One Page
Version: 0.4.1 Last Updated: 11/18/07 17:50:18

### module sqlalchemy.engine.strategies

Strategies for creating new instances of Engine types.

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)

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